How to Resolve the High Resource Consumption of WordPress Admin-ajax.php Process
WordPress Heartbeat is an API introduced in version 3.6 back in the days. This API simulates the bidirectional connection between the client browser and the server where the WordPress site is hosted. The API features many implementations but the most important are:
- Live communication between the client’s browser and the web-server with Ajax (no web page refresh needed)
- Improved user session management
- Tracking of different post revisions
- Auto-Saving posts
With such features, it is undoubtedly quite a handy tool that is fully enabled by default in WordPress.
The Problem
Recently we discovered that due to the Heartbeat functionality, our Shared Hosting clients are experienced a major issue with the resource consumption of their websites. It appears that in order for the WordPress Heartbeat to work properly, it spawns an additional admin-ajax.php process, which is making the Ajax requests to the index.php file of the wp-admin section.
Here is a simple example:
00:45:11 "POST /wp-admin/admin-ajax.php "http://example.com/wp-admin/index.php"
00:45:67 "POST /wp-admin/admin-ajax.php "http://example.com/wp-admin/index.php"
This is resulting in the constant spawn of new admin-ajax.php processes which are consuming quite a lot of resources:
503 user 20 0 358m 33.8 0.2 0:00.35 /home/user/public_html/wp-admin/admin-ajax.php
508 user 20 0 387m 25.1 0.4 0:00.79 /home/user/public_html/wp-admin/admin-ajax.php
The amount of spawned processes sometimes exceeds the number of allowed processes on our Shared Hosting environment, and this is resulting in 508 – “Resource limit reached”. This error can also be received if there is no CPU/RAM available for your account. That can happen because it has reached the virtually assigned limits or the hardware limitation in case you are using a service like our Dedicated Servers.
The Solution
The only common solution applicable by every WordPress user is actually quite a simple one – You need to either disable the Heartbeat API or you need a way to control it.
To control the API, you need to be fully aware of what it does, and also you should be well familiar with the code and the functionality of the WordPress application. In case you do not have the time to spare in order to check all the whitepapers, you should read the next few lines of this post.
The simplest and most effective solution to this issue is to install a plugin called Heartbeat Control. If you are not quite sure how to do that, please check our “Managing the plugins of your website” tutorial, where you will receive detailed and well-structured information on how to perform plugin installations.
Once you install the plugin, you will need to activate it, and then an additional item named Heartbeat Control will emerge into the Settings menu of your WordPress application.
If you click on that item, you will see quite a simple interface for the management of the Heartbeat API. Here you can use the Disable Heartbeat options to stop the API in your WordPress Dashboard, Frontend, or Post Editor sections. Click on the Save Changes button to preserve the configuration.
The Conclusion
Heartbeat is not mandatory for your WordPress website to work properly, and indeed this is the reason why sometimes WordPress owners are experiencing severe resource consumption issues with their web hosting services. FastComet fully supports the suggested fix, and we will gladly apply it for any customer of our services who would like to boost the performance of the used WordPress application.
The latest tips and news from the industry straight to your inbox!
Join 30,000+ subscribers for exclusive access to our monthly newsletter with insider cloud, hosting and WordPress tips!
Comments (9)
Hello, this version is old old now. You can re-post this article with updated images?
Thank you.
Thank you for this request.
The article has been updated with screenshots of the newest version of the plugin and a few changes in the text to reflect that.
Thank you very much! You are the best!!!
But how can we do that if we can’t even access the dashboard of our WordPress website ? (Ressource Limit Is Reached)
Hello Pingram3541,
We are sorry for the troubles you have experienced and we are always eager to assist our clients in resolving any technical issues that they may have. Having said that, I would like to suggest some additional troubleshooting of the issue, because it looks really strange.
We have a large number of clients using WordFence on our servers without experiencing any issues. The scan feature that comes with the plugin is one of the vital functionalities and we do not have complaints about it’s usage. A large portion of the websites that we host for our clients are built on top of WordPress and we constantly monitor for improvements of the environment to make sure that it all goes smoothly. We do not have any reports about the most popular plugins and their usage on our shared hosting servers.
This makes me believe that the issue may be caused due to a completely different thing. It is possible that a function on your application is timing out, causing issues with the way WordFence and other plugins work. This requires review, however, which means that I cannot share the exact cause at the moment. I have attempted to locate your account on Disqus, but I cannot see an exact domain or name and I cannot locate your tickets. At this point, I would recommend that you contact our technical support team again, so they can troubleshoot the issue in question further for you and then resolve it completely, or share some insight on how to proceed fixing it on your end.
You can also quote me on the ticket so I can investigate that further
I am looking forward to hearing back from you
This plugin only solves one problem however it doesn’t address the extreme level of restriction you have on your accounts in regards to script execution. Many of the common WordPress plugins today fail because the server responds with a 500 error when requested via admin-ajax.php. I have legit plugins I can’t use with FastComet but they work elsewhere. I can’t use the official CloudFlare plugin nor complete scans with WordFence or any searches with String Locator just to name a few.
I’ve tried going through tech support but I’m left feeling like I know more about the situation than they do yet don’t have access to fix these issues myself unless go to expensive VPS but also take on the chore of managing all the other crap I don’t want to. This is big problem and I’m considering migrating all my clients as we speak unless they loosen the restrictions. Heck, I can’t believe I’m saying this but even GoDaddy is not this restrictive. I just can’t work with these interruptions.
I find I keep ‘Resource Limit is reached’ so I have downloaded and installed this plugin. I hope it solves the issue and thanks your your update on this
can you tell me, what effect from plugin hearbet if control hearbet is Disable Everywhere ?
The plugin “Heartbeat Control” is used to disable on some or all pages the Heartbeat API when set API has become an issue to the user in the shared hosting environment. The API itself is pretty useful as described in the first few rows of the article, but it is not mandatory, thus can be safely disabled.