cpulimit - useful!

Bob ubuntu-qygzanxc at listemail.net
Fri Sep 26 18:15:11 UTC 2014


** Reply to message from Karl Auer <kauer at biplane.com.au> on Fri, 26 Sep 2014
16:36:29 +1000

> This is probably very old news for many, but I just found a nifty little
> program for the first time: cpulimit.
> 
> I convert a lot of video files. A favourite source supplies only .FLV,
> but some family members are Apple-bound and require .MOV, so I convert
> the videos and store the results on our fileserver. It has annoyed me
> for some time that while avconv is running on my system, I am
> effectively prevented from doing anything else. The window manager
> becomes jerky, freezes for several seconds long, video playback is
> unusably jerky and stops for many seconds at a time, or the image loses
> sync with the sound. Even the mouse sometimes stops being responsive.
> Looking at usage with top, I see that avconv is using 150% of the CPU,
> sometimes more.
> 
> Finally it all got too much and I went looking for a solution - and
> found cpulimit.
> 
> This delightfully simple little program lets you specify a process name
> or ID, and what percentage of processor power it is allowed to use.
> 
> I ran it on avconv, and avconv is now running (albeit slowly) in the
> background, while everything else (including me) keeps working. The
> really cool thing is that it applies to anything called avconv, for as
> long as it (cpulimit) is running - so even though my batch conversion
> script kicks off many copies of avconv (sequentially), all of them are
> tamed by one instance of cpulimit:
> 
>    sudo cpulimit -e aconv 45

Would "nice" work?

>From what I know I would think "nice" would work better as it would not slow
down your converter unless something else is needing the cpu.


> It doesn't seem clever enough to handle multiple simultaneous instances.
> When I started a second instance of avconv, it quickly ran up to 110% -
> while the first instance remained around 45%. Possibly in such cases the
> specific PIDs need to be controlled. But it's still very useful.

"nice" would also handle this condition.

-- 
Robert Blair




More information about the ubuntu-users mailing list