Use cpulimit to limit cpu usage in real time

Moderators: ashishsinha, alok, Linux Moderators

Use cpulimit to limit cpu usage in real time

Postby alok on Wed Apr 25, 2012 4:52 pm

OK I know, that you know how to check the cpu utilization of a process using top, htop, mpstat and sar command.

We can view the cpu being consumed by a process. But how to control it?

Here comes a very simple fun tool - cpulimit

Feel free to download it from http://cpulimit.sourceforge.net/

Those using ubuntu can download it by this simple command.

Code: Select all
sudo apt-get install cpulimit


Now the best thing about cpulimit is that it attempts to limit the cpu usage of a process. Limits are expressed in percentage and not in cpu time. cpulimit does not act on the nice value or other scheduling priority stuff, but on the real cpu usage.


Example #1 - To limit the cpu usage of a process evolution under 20%.

Code: Select all
sudo cpulimit -e evolution -l 20


Example #2. You can also use the pid of the process for the same job.

Code: Select all
sudo cpulimit -p 8888 -l 20


Here is the screenshot from my machine.. enjoy !!

You can view this post and many other interesting posts on our blog - http://www.networknuts.wordpress.com

networknuts-cpulimit.png
cpulimit restricting cpu usage
User avatar
alok
 
Posts: 231
Joined: Tue Dec 23, 2008 11:11 am

Return to Linux Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron