How To Reduce Admin-Ajax Server Load In WordPress

2
How To Reduce Admin-Ajax Server Load In WordPress

To increase better user experience, we always end up by increasing site speed. After clicking a website link seems like a simple thing. But have you ever thought, how many requests are instantly pinged within few seconds after a single click? There are lots of things happens within this few seconds that may slow down the website.

Although, there are various things behind slow loading of the site. If checking on site speed test tools, sometimes it shows a warning in admin Ajax.php file. That means Admin Ajax.php file is also one of the reasons behind slow loading of the site.

Admin-ajax.php is part of the WordPress AJAX API. It does handle requests from both backend and front end as well. Ajax allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes.

In WordPress 3.6, WordPress introduced Heartbeat API. The API stimulate bidirectional connection between the browser and the server. In addition, it was used for autosave, post locking, and log-in expiration warning while a user is writing or editing.

Heartbeat API triggers events on receiving data/response while creating requests for communication with the server. This generally causes a huge load on the server and thus slow down the website.

Due to this Heartbeat API, Admin-ajax.php generates requests after every 15 seconds. The request can be any communication with the server. And thus by sending too many requests, the server takes a long time to display your contents or load the website.

Speed up WordPress Admin Dashboard

So, the best solution to speed up the site at backend is by disabling the Heartbeat API. Instead, install the Heartbeat control plugin. Heartbeat control plugin allows you to easily manage the frequency of the WordPress heartbeat API. Through this plugin, the heartbeat API can be disabled entirely.

Note: If you are using any caching plugin, then disable the object cache before moving forward. It will drastically speed up the WordPress dashboard.

To Install Heartbeat Control plugin:

  1. Login to your WordPress Admin Dashboard.
  2. Go to Plugins>> Add new and search for Heartbeat Control.
  3. Now, Install and Activate it.

The configuration of HeartBeat Control Plugin:

  1. Go to settings and then Control HeartBeat (Settings>> Control Heartbeat)
  2. Now, select locations. The locations have three options to choose.
    • Disable Everywhere
    • Disable on Dashboard Page
    • Allow Only on Post Edit Page
  3. If I guess, your site regularly contributes more than 1 user. So, I suggest selecting Allow Only on Post Edit Page location to disable the plugin.
  4. Now, you need to select the time interval for executing admin-ajax requests by going through Override Heartbeat Frequency menu.
  5. Set the time interval of 60 seconds. By doing this, the requests will generate after every 60 seconds. This drastically reduces the load on the server.
  6. Now, search for the plugin that uses Heartbeat API.
    • To do so, Go to GTMetrix site and analyze your website. Now, go to Waterfall tab and analyze which file is taking long time to connect and response.
    • Now, scroll down and see if there is any entry for POST admin-ajax.php.
    • If yes, expand it and navigate to the Post tab to find the plugin.
  7. Now you are all set.

Related: Guide to Auto-Improve Server Response Time

There is one more option to sort this issue upgrade to a hosting plan that could handle the load of the requests. You can also check our tips to make your WordPress Blog Faster.

2 COMMENTS

  1. Thank you very much for your help. We have a project where your posts with the Newspaper theme have been helpful.

    There is one item I’m not clear about. Item #6. I’ve looked at GTMetrix Waterfall…not being familiar with the information I’m looking at, not sure I’m able to figure out what you’re getting at with #6.

    Any additional explanation would be helpful.

LEAVE A REPLY

Please enter your comment!
Please enter your name here