CPULimit is an effective tool for managing and limiting the CPU utilization of your VPS server. It allows you to limit each process that might be using excessive CPU resources and affecting other processes on the server. You can use it to better manage CPU usage for several CPU-intensive processes while ensuring some CPU capacity remains available for unexpected tasks.
Installing CPULimit
CPULimit Usage
Here's an example of running a dd
command to create a CPU-intensive process and then limiting it using CPULimit.
Running the dd
Command:
dd if=/dev/zero of=/dev/null &
Check the dd
Process Usage and PID:
top
You should see something like:

Here, the CPU usage for the dd
process is 39.5%. Now, let's use CPULimit to limit the process CPU usage to 15%.
Limiting the Process CPU Usage:
cpulimit -l 15 -p 19739 &
- The
-l
argument refers to the percentage value of the CPU to be assigned.
- The
-p
argument refers to the process ID.
Verify the CPU Usage:
After executing the command, use top
again to check the CPU usage. The value should be around 15% (+/- 2%).
That's it! Now you know how to use CPULimit to manage CPU utilization for a specific process.