{"id":576,"date":"2012-07-10T11:23:39","date_gmt":"2012-07-10T03:23:39","guid":{"rendered":"http:\/\/rmohan.com\/?p=576"},"modified":"2012-07-10T11:23:39","modified_gmt":"2012-07-10T03:23:39","slug":"limit-the-cpu-usage-of-an-application-process-cpulimit","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=576","title":{"rendered":"Limit the CPU usage of an application (process) &#8211; cpulimit"},"content":{"rendered":"<h3><a href=\"http:\/\/linuxpoison.blogspot.sg\/2009\/07\/limit-cpu-usage-of-application-process.html\">Limit the CPU usage of an application (process) &#8211; cpulimit<\/a><\/h3>\n<p>&nbsp;<\/p>\n<p>cpulimit is a simple program that 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&#8217;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.<\/p>\n<p><strong>Installation:<\/strong><br \/>\nDownload last stable version of <a href=\"http:\/\/downloads.sourceforge.net\/cpulimit\/cpulimit-1.1.tar.gz\">cpulimit<\/a><br \/>\nThen extract the source and compile with make:<\/p>\n<p>tar zxf cpulimit-xxx.tar.gz<br \/>\ncd cpulimit-xxx<br \/>\nmake<\/p>\n<p>Executable file name is <em>cpulimit<\/em>. You may want to copy it in \/usr\/bin.<\/p>\n<p><strong>Usage:<\/strong><br \/>\nLimit the process &#8216;bigloop&#8217; by executable name to 40% CPU:<\/p>\n<p>cpulimit &#8211;exe bigloop &#8211;limit 40<br \/>\ncpulimit &#8211;exe \/usr\/local\/bin\/bigloop &#8211;limit 40<\/p>\n<p>Limit a process by PID to 55% CPU:<\/p>\n<p>cpulimit &#8211;pid 2960 &#8211;limit 55<\/p>\n<p>cpulimit should run at least with the same user running the controlled process. But it is much better if you run cpulimit as root, in order to have a higher priority and a more precise control.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Limit the CPU usage of an application (process) &#8211; cpulimit <\/p>\n<p>&nbsp;<\/p>\n<p>cpulimit is a simple program that 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&#8217;t want them to eat too much cpu. It does not act on [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/576"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=576"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/576\/revisions"}],"predecessor-version":[{"id":578,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/576\/revisions\/578"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}