How to Reduce admin-ajax.php Server Load in WordPress

1. Use a caching plugin: Caching plugins like W3 Total Cache and WP Super Cache can help reduce the load on your server by caching static versions of your pages and serving them to visitors instead of loading the entire page from the database each time.

2. Optimize your database: Optimizing your database can help reduce the number of queries that need to be processed each time a page is loaded. This can help reduce the load on your server.

3. Disable Heartbeat API: The Heartbeat API is a feature in WordPress that allows for real-time communication between the server and the browser. Disabling this feature can help reduce the load on your server.

4. Disable pingbacks and trackbacks: Pingbacks and trackbacks are a feature in WordPress that allow other websites to notify you when they link to your content. Disabling this feature can help reduce the load on your server.

5. Limit post revisions: Post revisions are a feature in WordPress that allows you to save multiple versions of a post. Limiting the number of post revisions can help reduce the load on your server.

6. Disable plugins: Plugins can add extra code to your site, which can increase the load on your server. Disabling any unnecessary plugins can help reduce the load on your server.

Website performance is a critical subject for any site owner. Performance issues can affect users’ experience and potentially reduce SEO ranking. As Google uses page load time in their ranking criteria.

When we think about website performance, often we talk about page load time. In WordPress, a common scenario when dealing with a load time issue is that it might be caused by a spike in the admin-ajax.php file.

In this article, you’ll learn how to manage plugin conflicts caused by spikes in the admin-ajax.php file and reduce the request for callbacks to optimize your WordPress site’s load time.

What Is the admin-ajax.php File in WordPress?

In 2013, WordPress version 3.6 was introduced along with Heartbeat API at its core. WordPress Heartbeat API is built as a communication protocol between the browser and the server. It uses admin-ajax.php to send a request to the server and trigger events (or callbacks) when receiving data. The main features of the Heartbeat API are:

When you write a piece on WordPress, save it as a draft, and continue working on it, WordPress automatically saves any addition you make.

  • Post Locking and Login Notification

In a collaborative WordPress website, you’ll receive a pop-up whenever you try to write/edit a post that another user is currently working on. You’ll also get a popup notification when your session is expired, and a new login is needed to keep working on your post.

Problems That admin-ajax.php Can Cause

Overflowing the admin-ajax.php file can cause a page load time issue, which is a serious problem. The internet golden rule is that your site should fully load within 3 seconds or less. If it takes longer than that, chances are you give visitors a bad experience and drive them away.

Slow page speed can negatively affect your SEO ranking too. You should be aware that Google uses load speed as one of the indicators in their algorithm to rank sites. Besides, slow page speed means that the search engine can crawl fewer pages using their allocated crawl budget, and that will affect your pages indexation even further.

For some of us, the only time we’re dealing with this API is when we use speed test tools — such as GTmetrix, to figure out why admin-ajax.php is slowing down our websites.

Spikes in admin-ajax.php illustrated using GTmetrix

The causes for spikes can be from two different sources, either caused by third-party plugins or WordPress Heartbeat API request on the admin section. We’ll discuss it in more detail below.

How Plugins Can Overflow the admin-ajax.php File

Third-party plugins cause the most common problem when users see a spike on admin-ajax.php. If done correctly, AJAX is definitely a good thing, as developers usually use it to add functionality to their plugins. For example, developers can use AJAX requests and create a custom wp_query to display dynamic content on a cached page.

But sometimes when many plugins use these queries, they can cause an overflow. Thus it can create a spike and slow down the whole website. So, if you’re a developer, here’s a resource to properly implement AJAX in plugins.

As a website owner, you may need to diagnose the plugins first before disabling them. This is important to figure out if a particular plugin causes the load time issue.

Diagnosing Plugins

Conflicting plugins can cause a load time issue. The old school way is you can always disable all plugins to fix the problem, and re-enable them one by one using a process of elimination. But it’s definitely not a great solution.

We’ll use a more proper method to figure out the root cause of the problem with the following scenario.

Upon activating several plugins, you notice that your website needs a longer time to fully load. You then diagnose the site using GTmetrix. It’s a powerful free speed test tool that allows us to see the individual post response data.

Method A

Go to the GTmetrix homepage, fill out your website URL, and click Analyze. It takes a while to analyze your site completely.

GTmetrix homepage

When finished, you’ll get a report of your website condition such as performance score and page details. Go to the Waterfall tab to inspect the website elements in more detail.

GTmetrix diagnose Windows with Waterfall field highlighted

The Waterfall window will present all of your website’s elements. While the rest of the files look ok, you notice that POST admin-ajax.php takes a longer loading time.

GTmetrix details reported spikes in POST admin-ajax.php

Click on POST admin-ajax.php, and you’ll see four different tabs available: Headers, Parameters, Post, and Response. When diagnosing this kind of issue, the Post and Response tabs are the place you need to look at.

For this site, we see a clue in the Post tab as that request has something to do with the “count_hit” script.

POST admin-ajax.php details clicked on

That clue is leading us to suspect a certain post hit counter plugin that we’ve installed earlier. So, to prove that theory, we disable that plugin and run a second test with GTmetrix for our site.

Test speed result when the suspected plugin deactivated

It turns out our suspicion is correct. By disabling that plugin, we manage to reduce our page loads by 2 secs.

Method B

You can also use the Chrome developer console to find the suspected plugin.

Open your website. Right-click in the page -> Inspect. Alternatively, on the Chrome tab go to View -> Developer -> Developer Tools.

Click on Network tab and reload your website.

Chrome consol reports admin-ajax.php

In the filter box (right below the red dot) enter admin-ajax.php. You’ll see the culprit for the said issue. After that, you can disable the plugin and test if the problem still exists.

As a website owner, if you really need to use this plugin, make sure to use the most updated version. If you’ve done that and the problem persists, reach out the plugin developer while mentioning this case.

If the developer cannot resolve the issue yet, you can always replace it with a new one. The beauty of WordPress is there are many similar plugins to choose from. Just go to the WordPress plugins directory and select the most used and updated plugin that offers the same functionality.

Speeding Up the Backend of Your WordPress Site

Sometimes, WordPress Heartbeat API triggered in the backend of your site can also cause performance issue. As we noted earlier, this feature helps to autosave your work — to avoid losing projects when the unexpected happens, and to manage simultaneous writing/editing properly.

For example, the function will be triggered every time you write a post and keep the tab open. This can cause high CPU usage, as you see by the number of callbacks in the developer console below.

Admin-ajax.php triggered on backend

CPU use is an important issue for those who are using a shared hosting plan. Some hosting providers probably won’t tolerate a high CPU usage and it can eventually lead to suspensions, although that is not the case with Hostinger, especially our WordPress plans.

To resolve this issue, you can do two things, disable the heartbeat API or make the intervals between the checks longer. Since the first option is not practical, we recommend using the second one instead.

Conclusion

You’ve learned about the Heartbeat API and its byproduct, admin-ajax.php. You’ve also learned about the issues that arise when plugins overflow the function and cause slowdowns. You also know that the Heartbeat API itself can create a problem with your host should you don’t manage it properly.

Remember, to always check with GTmetrix when you feel a slowdown happen on your website. Go the waterfall tab, navigate to POST admin-ajax.php and see how everything is doing. Don’t just disable all plugins at once, as sometimes they might be not the culprit. But if they do, either replace them or limit the heartbeat API use.

Do you have similar experience dealing with admin-ajax.php? Drop a comment in the comment section below so the world can also learn from your story!

How to Reduce admin-ajax.php Server Load in WordPress

admin-ajax.php is a WordPress core file that handles AJAX requests. It is used to perform various tasks such as saving settings, retrieving data, and more. Unfortunately, it can also be a major source of server load, especially if your WordPress site is receiving a lot of traffic.

In this article, we will show you how to reduce admin-ajax.php server load in WordPress.

Why is admin-ajax.php Causing High Server Load?

admin-ajax.php is a powerful file that handles AJAX requests. It is used by many WordPress plugins and themes to perform various tasks. For example, it is used to save settings, retrieve data, and more.

However, if your WordPress site is receiving a lot of traffic, then admin-ajax.php can become a major source of server load. This is because it is constantly being called by the browser to perform various tasks.

How to Reduce admin-ajax.php Server Load in WordPress

There are several ways to reduce admin-ajax.php server load in WordPress. Here are some of the most effective methods:

  • Disable Heartbeat API
  • Disable AJAX Calls on Frontend
  • Optimize Your Database
  • Disable Unused Plugins and Themes
  • Use a Caching Plugin
  • Use a Content Delivery Network (CDN)

Conclusion

admin-ajax.php is a powerful file that handles AJAX requests in WordPress. Unfortunately, it can also be a major source of server load if your WordPress site is receiving a lot of traffic. Fortunately, there are several ways to reduce admin-ajax.php server load in WordPress. We hope this article has helped you learn how to reduce admin-ajax.php server load in WordPress.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?