One of the limits we enforce a CPU limit to ensure that websites run as best as they can.
What exactly is CPU usage and why do we restrict it
As you know servers hosting your website have a processor (or mostly multiple). These processors perform a lot of tasks, but they spend most of the time running the programs that execute website code. And if the programs running on the server use too much processor power, the server itself will slow down and be practically inoperative.
Because we want everything to go without hinderances we have to implement the CPU limit to not slow down our servers as a whole.
To accomplish it every account simply has a limit on how much CPU power it can use. And if it hits that limit it firstly will be throttled. If it still uses to much power it will be suspended for 24 hours.
CPU usage - how is it calculated
The exact formula for calculating CPU usage is classified for a multitude of reasons.
With that out of the way it kind of works like “CPU seconds”
Basically every time a program executes it uses a certain percentage of a CPU core.
If you have 10 requests which use a quarter of a CPU core for 2 seconds it’s gonna use 10 * 0.25 * 2 = 5 CPU seconds.
Every account has an assigned amount of CPU seconds per 24 hours. If it exceeds that amount it will be suspended for 24 hours.
There is also a limit on how much power your account can use in a short span of time. It’s implemented to prevent small bursts of traffic from overloading our servers.
How many visitors can I have on my website
It is impossible to provide an exact number of visitors you can have on your page, because it depends on a few things i.e.:
- The number of pages they view
- Exact pages viewed by them
- Power the CPU needs to provide the loaded pages
How to reduce my CPU usage
There are 2 major factors responsible for your CPU usage:
- Code complexity: The more code is being used and the more complicated the code itself results in more CPU power being used
- Traffic on your website : The more hits your page gets the more code needs to be executed to render their pages resulting it more CPU power being used.
Knowing that there a few things that you could optimize to reduce your CPU usage:
- Remove unnecessary scripts and plugins – the less code the CPU needs to execute the less power it will use,
- Utilise data caching – by reusing the results of other requests you reduce the code needed to be executed with each action,
- Splitting scripts and website to other accounts – if you have multiple domains on your account you can just split them between a few to reduce server load by spreading it.
Why was my website suspended while I was setting it up
Remember that CPU usage is calculated by traffic and code complexity
Installing script, installing plugins and themes and importing content are complex tasks, hence requiring a lot of processing power. If you are doing a lot of tasks similar to these you can be generating a lot of CPU usage.
To prevent things like these from happening we recommend that you first experiment on your own computer. There is a lot of software that can help you with accomplishing it. For example WampServer or XAMPP. When you’re satisfied with the outcome you can replicate or migrate it on your hosting account.