Hosting Written by 0

Over the past week, I’ve had some rather big issues around the CPU usage of my WordPress websites.

To give you a background to this:

  • The hosting plan was with GoDaddy Entrepreneur business dedicated hosting, which has a 4 CPUs
  • There are 5 WordPress websites on the server

Jetpack had notified me that my main website went down multiple times in a few days, which is the first time it has ever done this. The reason this was happening was because the CPU was consistently throttling, causing the website to go down when it could not handle the CPU usage limit.

What on earth was happening?

 

Well, after lots of investigations, I have a few ways to reduce the CPU usage which others might find helpful in the same situation. Here are the findings.

 

Cache and double-check current cache

If you wanted to know what 198×345 is, you would use a calculator to find out its 68,310. If I was to ask again what 198×345 is, you should immediately know it’s 68,310. This is what caching pretty much does: it saves the CPU from having to compute tasks that it can store in cache files instead.

I’ve found that a cache is the most effective way to reduce the CPU usage of a server. If you are having any CPU issues, the first place to look is with your caching plugin:

  • Is the caching plugin actually caching?
  • Have you changed anything with the cache plugin recently?

 

Perform an admin-ajax.php analysis

The admin-ajax.php is a file on WordPress that is used for AJAX queries. Typically, this is for things such as auto-save on posts inside WordPress, although plugins that use AJAX can use the admin-ajax.php file too. Due to poor coding, this can cause the clock of the CPU to go crazy if the admin-ajax.php is not utilized in the correct manner.

  1. Go to GTMetrix
  2. Run an analysis of your homepage and a post page
  3. Control+ f to find any occurrences in the Waterfall for ‘ajax’
  4. If you find anything, analyse the waiting time – if it seems longer than 100ms, then this suggests it is the issue causing the CPU performance issues
  5. Click on the AJAX and ‘Response’ to see the code that is referencing the admin-ajax.php – this will illustrate to you what plugin is causing the issue, so you can debug or deactivate

 

Check auto-updating plugins

Having to do the above GTMetrix analysis is quite in-depth and time-consuming, so a quicker option would be to see what had changed since you noticed the CPU usage skyrocketing. WordPress allows plugins to auto-update, so have a look at what has recently changed and deactivate to see if this improves the situation. If you are able to find the plugin in question, contact the owner so they can work on a solution to the bug.

Will created Ask Will Online back in 2010 to help students revise and bloggers make money developing himself into an expert in PPC, blogging SEO, and online marketing. He now runs others websites such as Poem Analysis, Book Analysis, and Ocean Info. You can follow him @willGreeny.

Comments are closed.