It looks like you're new here. If you want to get involved, click one of these buttons!Sign In Register
It looks like you're new here. If you want to get involved, click one of these buttons!
CPULimit is a fine tool to manage and limit the CPU utilization of your VPS server. It allows you to limit each process that you might think is utilizing more CPU and affecting another process on the server. Or perhaps, you just want to manage the CPU usage better for a few different CPU-consuming processes, but at the same time leave some of the CPU available for any unexpected tasks and etc.
sudo apt get install cpulimit
sudo yum install epel release
sudo yum install cpulimit
An example is that we run dd command to have a heavy CPU usage process and limiting it using the CPULimit.
Running dd command:
dd if=/dev/zero of=/dev/null &
Check the dd process usage and PID
You should see something like:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19739 root 20 0 108096 616 520 R 39.5 0.0 0:09.48 dd
You can see the CPU usage for the dd process is 39.5%, now let's use CPULimit to limit the process CPU usage to 15%
cpulimit -l 15 -p 19739 &
After this command is executed you can use top again to check the CPU usage. The value should be around 15% (+/- 2%).
That is it, now you know how to use CPULimit to manage your CPU utilization for a specific process.