How to Limit WordPress Website CPU Usage on a Shared Server
If you’re reading this, I assume you’re either a web developer, or planning to become one. If you’re lucky enough to be building a WordPress website, you’ve probably also heard of the dreaded “WordPress CPU Usage” warning.
The WordPress CPU Usage warning shows up when WordPress is constantly hogging the processing resources of a web server. This could be because you’re doing something really creative with your website, or because you’ve got a lot of plugins running. Either way, it’s probably not a good thing.
On a regular basis, I’ll come across websites where the CPU Usage is pegged at 100% with no end in sight. Oftentimes, these websites are poorly optimized, or use a lot of outdated plugins. In other cases, it’ll be because the developer has crammed every bit of content possible into each post – regardless of whether it’s truly useful to the end user.
Why should you care about limiting your website’s CPU usage? Well, for starters, if you’re running a shared server, you’re sharing its resources with other websites and applications. If one of those applications goes haywire and starts hogging all the CPU power, it can have a serious impact on the performance of your website. In extreme cases, this can even lead to downtime or data loss.
Make Sure You’ve Got Enough Storage
If you’re reading this, you’re probably aware that hard drives are becoming cheaper and cheaper. To put it bluntly, you can get a 1TB hard drive for less than $100. While the price is certainly appealing, that doesn’t mean you should run out and buy the first one you see. As much as possible, you want to make sure that your hosting company has enough storage available for your website. How much storage do you need? That depends on you. If you’ve got a highly active blog, you might want to consider purchasing a secondary storage device to act as a backup.
For instance, if you’ve got a 1TB hard drive, that’s a lot of storage. At first glance, it might seem like you’ve got enough room to store all your website’s data. However, if you’ve got a 500GB hard drive, that’s not nearly enough space to store all your blog’s posts. In that case, you might want to consider paying an extra $10 per month for an additional 500GB of space.
Reduce Your Website’s Resource Consumption
You might be wondering what all the fuss is about with regards to the WordPress CPU Usage warning. After all, you’re only as good as the last hit your website takes. While it’s true that the warning is usually a result of a buggy application or plugin somewhere in your WordPress installation, that doesn’t mean it has to stay that way. The truth is, there are multiple ways for you to reduce the CPU usage of your website.
The first and most important step is to eliminate as many of the unused plugins as possible. Why are they there in the first place? Well, it’s because the developer who wrote them thought the world would work a certain way, and he wanted to make sure everything matched that model. Sadly, the world doesn’t work that way, and things don’t stay well when forced. The best approach is to remove as many of the plugins as possible and see if the website can run smoothly with only the WordPress core engine and essential plugins.
Once you’ve got that down, it’s time to work on eliminating the loops. Loops are all the small tasks or activities your website needs to perform, over and over again – like opening an internet connection, fetching a web page, and displaying it. For example, if you’ve got a blog about fashion, and you use a plugin to automatically display the newest post on your homepage, that’s a loop. If that’s the only loop on your site, you can significantly reduce your website’s resource consumption simply by switching to a different fashion blog.
Reduce The Amount Of Time Your Website Spend Blocking Resources
On the subject of resource consumption, it’s important to point out that your website will use up a lot of resources – not just the processing power of your server. The reason behind this is simple. In the grand scheme of things, your website is just a tiny fraction of the overall system. When you use up a lot of local storage, it means resources are being blocked somewhere else. For example, if you’re running a WordPress website off a dedicated server, but that server is also serving other websites, the amount of time your website spend blocking resources will be noticeable. It’s also important to keep in mind that if another website on the same server is experiencing hiccups, it’ll have an effect on your website as well.
Consider An Economy Version Of Your Website
In the same way you would consider an economy car vs a luxury car, you should consider whether or not to go for an economy version of your website. When you run an economy website, you typically get what you pay for – which is usually free. You can’t exactly charge people to read your blog, and you don’t need to offer a lot in terms of content to make it worth your while. It’s perfectly acceptable to have a simple blog with no more than a handful of posts each month. You’ll find a lot of success as long as you provide content that’s useful and compelling.
To further minimize your website’s resource consumption, you can use a tool like Cloudflare’s Workers to easily convert your website from a standard to an economy version. With Cloudflare Workers, you get the simplicity of a managed WordPress environment, without the need to run your own website.
As I mentioned before, not all warnings are bad. The WordPress CPU Usage warning is usually a result of a buggy plugin or application. In most cases, the fix is simply to remove or disable the plugin or application. In other cases, it could mean you need to upgrade your server or hire a different web host – although that’s a fairly expensive solution. Ultimately, you just need to be mindful of what’s going on, and try as much not to run too many plugins or use too many resources generally. Keep those errors to a minimum, and your website will thank you. Good luck out there.