How to Reduce admin-ajax.php Server Load in WordPress
A well-performing website is important in the success of a business. Having performance issues with the site can significantly affect SEO ranking and the users’ experience.
In terms of website performance, we usually think about page load time. If you run your website on WordPress, the common issue of page load time is when the admin-ajax.php file is overwhelmed. Today, we are going to show you how you can reduce the server load of admin-ajax.php that causes slow page load time. So, let us begin!
What Is admin-ajax.php?
The WP admin-ajax.php file is part of a communication protocol for WordPress Heartbeat API. It is needed to deliver requests to web servers and to trigger callbacks upon receiving data.
The Heartbeat API allows an auto-save feature for your posts, blocks other users from editing a post when one user is editing it, and lets you log in again when your session has expired.
What Are the Issues That WordPress admin-ajax.php Causes?
As mentioned earlier, overwhelming the admin-ajax.php file can slow down page load time. A web page should load in 3 seconds or even less. If it loads longer than 3 seconds, website visitors will likely leave your site.
Aside from that, your SEO ranking will also suffer. Google, for example, is using page load time as one of the elements to rank you high on the search results page. A slow page speed will also limit search engines to crawl fewer pages of your site that can negatively affect indexing.
The spikes in the file may be caused by the callbacks of the Heartbeat API or the plugins activated in your WordPress site. Regardless of the cause, we will show you how you can fix it.
Conflicts among your plugins can overwhelm admin-ajax.php. The common way of fixing the conflict is to uninstall and then reinstall the plugins. However, the problem with the file may remain. To make sure you know your page speed, you can check it using GTmetrix, a speed test tool.
To do this, go to GTmetrix’s website. Enter your website’s URL and press Test your site. It may take a while, so you must wait for it.
The tool will give you a report of your site’s status like page details and performance score. On the report, click Waterfall to look at the site’s data in more detail.
From the chart below, find POST admin-ajax.php and then click it once found. In there, you will have four tabs, and the Response and Post tabs are what you must check.
If you see that there is a request that deals with count_hit, it might be that there is a post hit counter plugin you recently installed. If you did install a plugin recently, you might want to disable it. Run GTmetrix again for a test. If it reduces page load speed, then you know the cause.
You can also use Chrome to check the faulty plugin. Go to your website and right click anywhere. Select Inspect.
Click on the Network tab and enter admin-ajax.php in the box below the red dot. You will then see the plugin that causes the issue. Disable the plugin and do the test again.
If you need the faulty plugin, ask help from a plugin developer. If they cannot resolve the issue, get an alternative plugin from WordPress.
Speeding Up Your Website’s Backend
If the Heartbeat API is causing the problem, then it exhausts your CPU usage. This problem is important to understand if you are using shared hosting. You might go beyond your limit that forces your web hosting provider to suspend your account.
To avoid this from happening, you disable the Heartbeat API or adjust the intervals of the callbacks. The first option may not be practical, so you might want to go with the second option.
To do so, install the Heartbeat Control plugin. You can follow our tutorial for installing plugins. Once activated, go to your dashboard’s Settings and select Heartbeat Control Settings.
On this page, you can manage the frequency for various locations. For Post Editor, set it to 200 and then save the changes.
Knowing the causes of why admin-ajax.php is overwhelmed is important. This way, you know how you can adjust your WordPress backend to resolve the page loading speed issue. You can either look at your plugins or check the WordPress Heartbeat API. Follow our guide in reducing the load server of your admin-ajax.php file and achieve faster page speed!