cpulimit is a simple program which 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.
1) Download, extract and make cpulimit from :
[root@server ~]# cd /tmp [root@server tmp]# wget http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz [root@server tmp]# tar zxf cpulimit-xxxx.tar.gz [root@server tmp]# cd cpulimit-xxxx [root@server cpulimit-xxxx]# make2) Now copy the executable file cpulimit in /usr/bin
[root@server cpulimit-xxxx]# cp -p cpulimit /usr/bin/3) Installation is complete, now you can delete the tarball you downloaded and also the directory you got when you extracted the tar ball.
4) To use cpulimit on any process to limit CPU usage, use the following syntax:
cpulimit --pid <PID of process> --limit <CPU usage limit in percentage>
For Example: To limit a process with a PID 2960 at 70% of CPU usage (not to use more than 70%) :
[root@server ~]# cpulimit --pid 2960 --limit 70Now, you will find that CPU usage for that PID will not increase more than 70%.
No comments:
Post a Comment