How to limit cpu usage for a process with cpulimit (Ubuntu / Debian server)

advertisement logo

 

cpulimit is a tool that can be used to limit cpu usage (throttle cpu usage) for a single process (by its PID). cpulimit is useful to ensure that a single process would not hogs the cpu cycles, which can be use by other processes. cpulimit is different from ‘nice’ as it limits the real cpu usage for a process, while ‘nice’ controls scheduling priorities for a particular process.

How to use cpulimit?
Basic usage:

cpulimit  -p [pid] -l [ cpu percentage]
cpulimit -p 12345  -l 25

Running cpulimit on background:

cpulimit -p 12345  -l 25 -z -b

Note: The cpu percentage is the same one as reported by the ‘top’ command.

cpulimit can be installed from Ubuntu and Debian 6.0 (Squeeze) repository through apt-get. The official website of cpulimit is http://limitcpu.sf.net


Share this post

Tags: , , , ,

Keep updated with the latest posts, be a part of over 1,000 subscribers! : email iconSubscribe to your email

Leave a Comment

Subscribe by email

Enter your Email