Max Out Web Server CPU Fix

Did You Max Out Your Web Server CPU? Here’s My Fix

Last Updated on by Michael Brockbank

When the CPU usage on a shared web hosting plan hits its max, the web server may become unresponsive and require a fix. Pages load slowly, or you may even get 503 or 500 errors in the browser. Here is what I had to do to fix my situation.

Just a heads up, though, there are a lot of things that can tax out the CPU and memory usage of your website. You may have to investigate further to troubleshoot your own problems.

What is Shared Web Hosting?

Shared web hosting is probably one of the most common, and most affordable, ways to build a website. The web server is “shared” by several account holders, which means you’re also sharing resources.

Think of it as an apartment building. Except in this case, the apartments hold websites.

The web host will allocate things like CPU, memory, and drive space per account. This means that you only have access to a specific amount of power before your site either becomes unstable or altogether blocked from operating.

When you reach the maximum allotment, you can start to see errors such as 500 and 503 pop up when trying to access your site. That’s because there is simply no more processing power available.

GreenGeeks Shared Hosting

What I Did to Fix the Max CPU Usage of My Web Server

I first noticed the issue as I was trying to blog yesterday. At around 12:30 pm or so, the websites became unstable and I was no longer able to access the backend of WordPress.

According to cPanel, the CPU and memory limit were both maxed out.

After spending some time with tech support, they tried to tell me that it was the Google crawler that was taxing out the CPU. Personally, I’ve never seen that before in 13 years of owning websites.

Looking at the logs, and knowing I don’t have a lot of traffic to the blogs, I knew something else had to be going wrong. The level 1 technician said he was going to escalate the problem to level 2.

Wrong Cron Coding in WordPress

One of the things tech support suggested to me months ago was to disable WP Cron and create real crons to fire instead. This is because cron jobs can get quite extensive after a while. It can quickly eat up resources on a shared server.

Well, I did that several months ago. But when I examined the coding yesterday to be certain, I had entered the coding incorrectly. Instead of using the term false, I had entered ‘false’.

Notice the apostrophes?

The actual code to add to wp-config is:
define(‘DISABLE_WP_CRON’, true);

After fixing the code, there was a slight improvement in memory usage. But, that didn’t stop the CPU. And according to the logs, Google really wasn’t tapping the sites as hard as tech support made it seem.

Plugin Incompatibility

Tech support wasn’t completely useless. In fact, they told me that something on one of the websites in particular was really ramping up usage. But, no one could really tell me what.

On a side note, I have five main blogs on one account.

There is only one plugin on that specific site that I don’t use anywhere else: Speed Booster Pack.

I was already debating on getting rid of that plugin because I already had a much better optimization tool for performance. After removing Speed Booster Pack, the CPU usage and memory dropped immediately.

My sites began operating like normal. In fact, I found them to be faster than before the fix was necessary to adjust the web server CPU being at max levels.

Perhaps the plugin was causing an issue all along. In any case, it’s never a good idea to have too many plugins trying to accomplish the same goals. The only thing I can think of is perhaps Speed Booster was stuck in some kind of caching loop that kept the CPU running.

In any case, removing the plugin solved the problem.

The Importance of Plugin Stability in WordPress

I didn’t think anything of it, to leave a plugin running that I really didn’t want or need. I figured I would just come back to it later and really decide if I wanted to keep it.

Needing to fix the web server because it hit the max CPU usage was all the convincing I needed. But, it was a problem that really didn’t need to happen in the first place.

What really frustrates me is that I knew better. But, I was taking a chance on the outcome. This time, I lost. Luckily, I didn’t lose too much traffic in the end. However, it could have been a lot worse.

So, what are some things you can do to prevent your own similar issues when it comes to plugins?

Only Stick to One Per Purpose

Sometimes plugins don’t play well together. In fact, W3 Total Cache has issues with several other caching plugins if running at the same time. I can only assume that was the case in my situation.

I wasn’t running W3, but I did have Speed Booster as well as Autoptimize and Cache Enabler running at the same time.

Stacking up on optimization plugins can cause all kinds of hell. Though, this is the first time I’ve ever had to fix a max CPU usage error on a web server.

Make sure your plugins aren’t wreaking havoc with one another.

Remove Plugins You No Longer Use

A good habit to get into is to remove plugins you are no longer using. This includes tools that are installed and not activated or those that you really don’t want to keep around.

Not only does this increase the likelihood of compatibility issues, but it also takes up inodes on your server. In other words, you’ll hit your drive space allotment much quicker.

Not to mention that plugins you have just laying around could become outdated, which makes them security threats from hackers and bots.

Remove Plugins that are Outdated

Speaking of hackers and bots, plugins that no longer receive constant updates could be riddled with compromises. Because web coding is always evolving, you could inadvertently give a hacker a way into your website with old code.

Another reason to replace outdated plugins is because of new coding elements and practices. This means those older tools will eventually become incompatible with newer versions of your website anyway.

For instance, I came across a plugin once that was tailored for PHP 5.5. As soon as PHP 7 came out, the plugin crashed in profound ways. I can’t remember exactly what plugin it was, but I got rid of it immediately.

Only Install Plugins You Absolutely Need

There’s no doubt that some plugins are just going to make blogging life easier. For instance, I am a big fan of Yoast SEO.

However, you don’t need to install everything you think looks cool. Try to keep your site streamlined by only using what is absolutely necessary.

It’ll keep the inode count low and reduce the chances of incompatibility issues and a messy database.

Owning a Website is Constant Maintenance

Managing a website is a full-time job. Even those who have small blogs need to keep on their toes to keep the site running perfectly.

One day, you might be blogging without a care in the world. Then suddenly, your sites max out the CPU on the web server and you wind up spending several hours on the fix.

In the meantime, visitors are unable to access your pages.

Never underestimate spending a few moments of time every week or so maintaining the backend of your WordPress website.

Michael Brockbank
Follow Me...

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments