Setup maximum cpu consumption by a process with cpulimit


Please shareShare on Facebook0Share on Google+0Tweet about this on Twitter0Share on LinkedIn0Share on Reddit0Digg thisShare on StumbleUpon0Share on VKBuffer this page

cpulimit is a simple program that attempts to limit the cpu usage of a process (expressed in percentage, not in cpu time). This is useful to control batch jobs, when you don’t want them to eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly.

Install CPU limit on ubuntu :

sudo apt-get install cpulimit

How to use cpulimit?

Limit the process ‘bigloop’ by executable name to 20% CPU:

 cpulimit --exe bigloop --limit 20


cpulimit --exe /usr/local/bin/bigloop --limit 20 

Limit a process by PID to 45% CPU:

cpulimit --pid 2960 --limit 45

Use the  command bellow to find more about cpulimit:

man cpulimit

You can find a complete and more detailled about cpulimit use on this link