Log out of WordPress admin dashboard when not in useWritten by Jacob Nicholson
In this article I'll quickly discuss why you should be logging out of your WordPress admin dashboard when not in use. There can be multiple requests that your web-browser sends to the /wp-admin/admin-ajax.php script while you are logged into the WordPress admin dashboard, and leaving your computer unattended over the course of the day those requests can add up to a large amount of resource usage.
I actually just answered a ticket where a customer was having this exact issue and it unfortunately led to their account being suspended for using up over 350% of their allotted CPU resources on a shared server. So knowing just exactly what it is WordPress is doing even when you're not at your computer is important information to have to protect yourself from having the same thing happen to you.
Excessive requests for admin-ajax.php
In this example that I'm talking about these were the requests per hour that were happening from the customer's own IP address to the server:
Their requests totaled 24.335 POST requests to /wp-admin/admin-ajax.php at a rate of about 30 requests per minute. You can see around 2:00 (14:00) the requests died off as the account was suspended at that time.
By default the /wp-admin/admin-ajax.php script is used primarily by plugins so that they can continue to send information to the server from the admin dashboard regardless of you clicking on a link telling WordPress to do something.
In a lot of cases this is perfectly fine, as you might work on your WordPress site for a few hours and then move on to other things. However if you simply leave open the WordPress admin dashboard and don't close your web-browser and walk away from your computer and start doing other things, WordPress doesn't know this and so will continue to send in further requests to the server.
Editing pages and posts uses admin-ajax.php
When you're editing a WordPress page or post in your admin dashboard the admin-ajax.php script is utilized to autosave any changes. So if you're making a whole lot of edits and leaving the admin dashboard open this can add up to a large amount of resource usage on a shared server. This amount of usage would probably be negligible when on a VPS (Virtual Private Server) or dedicated server.
Heavy admin-ajax.php usage plugins
There are several know WordPress plugins that use the /wp-admin/admin-ajax.php script pretty extensively to facilitate their function. It would be recommended to be on at least a VPS (Virtual Private Server) and even better to be on a dedicated server if you are consistently using these plugins for long periods of time throughout the day:
We will add to this list as we discover more intensive plugins, please also use the Your Opinion Matters to the top-right to let us know about any other WordPress plugins you might have had resource usage issues with.
The best sure way to ensure these type of problems don't happen for you is being sure to logout of the WordPress admin dashboard, and to also close out your web-browser to be 100% sure that all requests from your computer to the server have ceased.