I am using godaddy to host two of my sites, both are wordpress sites. I recently received an e-mail from godaddy saying my cpu usage and physical memory usage is very high (reaching my current maximum limit). They offer the option to buy more resources, but I would like to know if this is really necessary or if there’s another way to get those usages down?Lola
Hi Lola! Before I go into lowing your CPU and memory usage, I’m first going to talk about what those things are.
What is CPU? How about memory?
You may have heard the terms “CPU” and “memory” (or “RAM”) when purchasing a new computer. These are components that help run your computer, and since servers are basically powerful computers they exist in servers (your web hosting) as well. These components help power your website and keep it running.
The more traffic you have, the more resources you use
The more people you get visiting your site, the more work the server has to do to keep it running. It’s like when you’re using your computer, the more applications you have open the more resources your computer uses to keep the applications running. Has your computer ever gotten laggy when using Photoshop? Or if you just had 10 applications open at the same time? Or if you tried watching a movie WHILE using Photoshop? If your computer gets laggy it’s because it’s maxing out on the CPU and/or RAM. It’s using all the resources it has available and when there are none left, your computer either slows down or can even crash completely (like if an application “unexpectedly quits”).
Your web hosting works exactly the same way. The more people you have browsing your site at the same time, the harder your server has to work in order to serve the content to those people. The harder it’s working, the more resources it uses. But if it uses all the resources it has available, your site will slow way down (or maybe even go offline completely!).
How can you cut back on your usage?
There are a few measures you can take to cut back on your usage, but after a certain point you have to accept that you’re just getting too much traffic. But before we go there, let’s look at the measures you can take.
Use a caching plugin
I’ve already done a post on how caching plugins work so you can read that if you want more details. But to put it simply, a caching plugin can help your site use fewer resources, which will cut back on your CPU and memory usage.
Two caching plugins you can check out are:
However, you may need to experiment with the caching plugin settings a bit. Sometimes using the wrong settings can cause your memory usage to go up. So just keep an eye on your usage levels after first installing.
Review your plugins
Some plugins are “heavier” than others and will use more resources. First, go through your plugin list and deactive and delete any plugins you’re not using. There’s no sense in keeping them around!
Then, review your plugins again, looking at the ones you actually do use. Ask yourself, “Do I really need this?” Some hosts will even show you how much CPU/RAM you use, so you can make note of how much you’re using, deactivate a bunch of plugins, then check back in and see if your usage has dropped. This would be a great way to determine how deactivating plugins could affect your usage.
Switch to Nginx (advanced)
By default, most websites run on something called “Apache”. Apache has been kind of the standard setup for a long time. However, there is another option called Nginx, which is what I use on my own sites. Nginx is pretty awesome for a few main reasons:
- It has a pretty awesome caching options and if you use those you don’t even need a separate WordPress plugin for caching.
- Nginx is famous for using significantly fewer resources than Apache.
- It is much, much, MUCH faster than Apache, especially for loading static resources like images.
Switching from Apache to Nginx could easily cut your resource usage in half!
So if you’re using a managed VPS, you should be able to ask your hosting company to switch you from Apache to Nginx. It is kind of a process, but if you have a managed host they should be able to sort this out for you. After all, if it’s “managed”, this is the kind of support you’re paying for. 😉
Done all those things & still using a lot of CPU/RAM?
The bigger and more popular your site gets, the more resources it’s going to use. Period. That’s why you don’t see Twitter using shared web hosting (hahaha, imagine that!). Twitter has 271 million monthly active users and 500 million tweets are sent per day. That’s a lot of traffic and lot of resources. This is obviously an extreme example, but my point is that shared hosting or small hosting plans can’t accommodate that kind of traffic. That’s why Twitter probably spends hundreds of thousands of dollars on their servers.
After a certain point, you just have to accept that your site is getting more popular and you have to pay more money in order to deal with the traffic. This is why a lot of sites end up moving to a VPS or even a dedicated server. Not sure what the difference is? You can read my post about comparing shared, VPS, and dedicated hosting.
First, try installing a caching plugin and deleting any plugins you don’t need. If your usage is still high after that, then you will have to pay to upgrade to another package that offers more resources.