How to limit CPU ususage for a process?



Here are the steps those I followed :

Install cpulimit binary:-

Type the following commands to install latest stable release:
# cd /tmp
# wget 'http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz'

# tar -zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /usr/local/sbin/
# rm -rf cpulimit*

Note : You can search the latest tar file.

===
if gcc is not on the server, please run yum install gcc*. I got error here.
===

How do I use cpulimit?

To limit CPU usage of the process called firefox to 30%, enter:
# cpulimit -e firefox -l 30
To limit CPU usage of the process to 30% by using its PID, enter:
# cpulimit -p 1313 -l 30

====
PS:

[root@cy cpulimit-1.1]# cpulimit --help
Usage: cpulimit TARGET [OPTIONS...]
TARGET must be exactly one of these:
-p, --pid=N pid of the process
-e, --exe=FILE name of the executable program file
-P, --path=PATH absolute path name of the executable program file
OPTIONS
-l, --limit=N percentage of cpu allowed from 0 to 100 (mandatory)
-v, --verbose show control statistics
-z, --lazy exit if there is no suitable target process, or if it dies
-h, --help display this help and exit
[root@cy cpulimit-1.1]#
=====
By : webhostingtalk.com



Related Posts:



Responses

0 Respones to "How to limit CPU ususage for a process?"

Post a Comment

»Thank you for reading this article
If you have questions or comments, please leave a comment
»You can click on the Subscribe by email to subscribe comments of this post
»You can register directly link pictures, mp3, video on the comment form.
»You may use some HTML tags such
»Please post comments polite and typing accented Vietnamese if possible
»Thank the good faith comment

 

Categories

Recent Comments

Total Pageviews

Return to top of page ©Web Server Tips Tricks 2010 | Develop by Mr.PhanQuan .Powered by Blogger . All rights reserved.