High CPU usage is a very common issue when it comes to shared hosting. Shared server hosts hundreds to thousands of websites and many of them are running their queries.
Shared hosting tends to be limited in terms of resources and usage allocations. Many web hosts out there do offer unlimited bandwidth and storage, whereas still others are happy to provide very high amounts of storage space and bandwidth. However, the restrictions on shared accounts are generally imposed on memory usage and I/O allocations. This does not mean you cannot run a website properly on shared packages. In fact, it is highly possible to run a busy website on a shared hosting account, but you do need to optimize your website well.
Now, the question is, what to do if your website on shared hosting consumes too many resources? Why is that happening and is there a remedy for it that you can use to fix the issue?
What is Resources Meant?
There are many factors that restricted on shared hosting. But, in today post, we referring to disk space and bandwith usage. Agree? If yes, then you can keep reading about this post below:
Strictly speaking, the term “resources” does refer to disk space and bandwidth on your shared hosting account. You are given a fixed quota of storage and bandwidth, and if exceeded, that is counted as a resource overuse. Please bear in mind that there are no unlimited space or bandwith. Although your hosting providers offer unlimited usage, there will be fair usage policy that limits the number of files that you can store and that each site should be used by your site.
However, it goes beyond that. The memory available to your account as well as the number of concurrent processes and database connections that you can run — everything comes under “resources”. Quite obviously, even though you may never cross the allotted storage space, you can still overstep the memory limits and consume too many resources.
Naturally, since bandwidth is cheap, hosts do not shy away from offering many GBs of it. On the other hand, memory and server specs are rarely cheap, so hosts often tend to limit them rather rigidly.
How My Account Consume High Usage?
Basically, there are innumerable and uncountable scenarios wherein you can overuse the resources for your shared hosting account. For example:
- You consume extra disk space of bandwidth than the allotted quota. In this case, your account stands suspended.
- Your storage and bandwidth limits are in order, but you consume too much memory (be it vMem or pMem). In this case, your account works but your website becomes unavailable until the issue is resolved.
- You consume too many I/O units or processes. Your website might throw a 503 error in this case.
- Everything is fine, but your website attempts way too many database or PHP connections at the same time. This is generally a temporary glitch and is resolved shortly.
As you can see, resource usage is never a one-dimensional subject and there are various limits and checks in place. Yet, the most common reason for consumption of too many resources is that your website is busier than you think. Maybe you are getting more traffic than the given account can handle.
There is no rule of law here, but mostly, a good shared hosting account can handle 10,000+ hits in a day (not all at the same hour, obviously). Once again, this is just a number and your case may vary from one host to another. If the traffic is responsible for resource overuse, an upgrade is generally the only way out.
However, what if your traffic is minimal? Barely a few visitors in a day, or maybe a few hundreds? Yet, you see resource overuse warnings again and again. Why is this happening and how can you fix it?
There are three different aspects that you should look at.
1. Check the Limits
Before anything else, check the limits on your hosting account. Is your web hosting provider offering severely limited resources? If yes, it is probably time to move to a new web host.
Once again, look beyond disk space and bandwidth. What about memory limits? Minimum 1 GB of pMem is expected from a decent shared hosting provider; and if there is vMem, the pMem should still not fall below 768 MB. Similarly, if you are on a SSD storage account, check the I/O allocation. I/O below 1.5 MB/s is not acceptable in today’s times. There are web hosting providers out there that offer as much as 5 MB/s of I/O on shared accounts.
Secondly, if you find the number of processes or concurrent connections too low (generally, 20+ is the norm), check with your web hosting provider. Many web hosts do not mind making an exception for this particular rule.
Once you have verified that the resources allotted to you are the industry standard and not too low, it is time to move on to the next step.
2. Check the Hosting Account
There are certain things that you can look at in your shared hosting account to ensure that resource usage is on the lower side. If you are hitting bandwidth limits, before anything else, look at image hotlinking settings. Turn Hotlink Protection on by all means!
Similarly, memory usage can be linked to cron jobs. Cron jobs can vary from scheduled backups or Softaculous automated updates. Older versions of languages such as PHP too might consume more resources than expected.
Perform a thorough checkup of your web hosting account and verify that the settings are in order. Then, move on to the third step if resources are still scarce.
3. Check the Website
If you are running a CMS such as WordPress or Drupal, ensure that the number of plugins or extensions is not too high. You can also reduce memory consumption by using a caching solution and a CDN, if you wish. Alternatively, verify that the plugins that you are using are not recursively calling any code as it can consume excess memory (almost all major CMSs have custom extensions to verify this easily).
Having your website throttled due to resource overuse is never a good thing. In fact, it generally tends to happen at the worst possible time — when you are sleeping, or on a vacation, or at the airport. Therefore, it can prove helpful to be proactive and ensure that everything is in order.
Only opt for web hosts that are lenient with their limits on shared accounts. Furthermore, keep your website optimized so as to reduce memory consumption. Lastly, if the resource overuse is happening only because of a temporary spike in traffic, do not upgrade your plan right away!