{"id":488,"date":"2012-11-30T16:29:23","date_gmt":"2012-11-30T21:29:23","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2012\/11\/30\/limit-cpu-usage-of-intensive-tasks\/"},"modified":"2021-08-16T23:27:38","modified_gmt":"2021-08-17T03:27:38","slug":"limit-cpu-usage-of-intensive-tasks","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/","title":{"rendered":"Limit CPU usage of intensive tasks"},"content":{"rendered":"<p>In this article we&#8217;ll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren&#8217;t causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.<\/p>\n<p>Limiting your CPU usage is a more advanced task that would require a VPS or dedicated server hosting plan. On a VPS you can limit CPU usage to help ensure that you&#8217;re remaining within the limits of your VPS package, so that you don&#8217;t affect your VPS neighbors sharing the same physical hardware with you and possibly risk a temporary suspension. On a dedicated server you can limit the CPU usage of these intensive tasks to help ensure you don&#8217;t slow things down overall on your own server.<\/p>\n<p>For instance lets say that you run a nightly backup of your site&#8217;s files, this type of task typically isn&#8217;t too time sensitive, so letting the intensive archiving of the backup process run over the course of an hour or so should be fine. If the server is busy at the time it would need most of its CPU time to handle website\/email\/database requests, and if you throw an intensive task in the mix it could make everything slow down.<\/p>\n<p>cPanel comes with a script called <strong>cpuwatch<\/strong> which allows you to watch the current load of your server while a process is running. If the load on the server exceeds the limit that you&#8217;ve set for the load, it will go ahead and pause the process and leave it paused until the server has become stable again. This is a great way to start something intensive and set it and forget it, without having to worry about it bogging down your server.<\/p>\n<p>In the example below I&#8217;ll be backing up a <strong>\/public_html\/<\/strong> directory to an archived file and limiting the CPU usage so it doesn&#8217;t slow down the server at all.<\/p>\n<ol class=\"article_list\">\n<li><a href=\"\/support\/server\/ssh\/how-to-login-ssh\/\">Login to your server via SSH<\/a><\/li>\n<li>If you&#8217;re on a VPS you&#8217;ll always want to set the CPU limit to 1 or lower (.9 .8 .7 etc&#8230;), or on a dedicated server you can run the following command to see how many processors you have which will affect how high your load average can get before things start running slow: <code>grep pro \/proc\/cpuinfo -c<\/code>This should simply give back the number of cores: <code>4<\/code><\/li>\n<li>Now you can enter in the path to the <strong>cpuwatch<\/strong> script, followed by the limit on how high the load can get before the task is paused, followed by your task to run: <code>\/usr\/local\/cpanel\/bin\/cpuwatch 4 tar cvzf 11-30-2012.tar.gz .\/public_html\/<\/code>In this case we are setting the limit to pause at to a <strong>4<\/strong>, using the <strong>tar cvzf<\/strong> command to archive files into a file called <strong>11-30-2012.tar.gz<\/strong>, and we&#8217;re doing this to all files in our <strong>\/public_html<\/strong> directory.Because we used the <strong>v<\/strong>erbose option on our <strong>tar<\/strong> command, we&#8217;ll see the active file that is being archived as the task runs. While this is happening if our server&#8217;s load reaches a 4 or higher you&#8217;ll start seeing that the process gets paused until it falls back below that threshold.\n<p><code>.\/public_html\/.htaccess<br \/>\n.\/public_html\/index.php<br \/>\n.\/public_html\/images\/logo.gif<br \/>\nWaiting for load to go down to continue<br \/>\nWaiting for load to go down to continue Waiting for load to go down to continue<br \/>\n.\/public_html\/images\/magnify.gif<br \/>\n.\/public_html\/images\/nested.gif<\/code><\/li>\n<\/ol>\n<p>You should now understand how to use the powerful <strong>cpuwatch<\/strong> script to help keep your intensive tasks from overloading your server. You can also use <strong>cpuwatch<\/strong> in your cronjobs so you don&#8217;t have to be sitting there at the console to take advantage of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article we&#8217;ll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren&#8217;t causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task. Limiting<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4364],"tags":[],"class_list":["post-488","post","type-post","status-publish","format-standard","hentry","category-server-usage"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Limit CPU usage of intensive tasks | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"In this article we&#039;ll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren&#039;t causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Limit CPU usage of intensive tasks | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"In this article we&#039;ll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren&#039;t causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-30T21:29:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-17T03:27:38+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"Limit CPU usage of intensive tasks\",\"datePublished\":\"2012-11-30T21:29:23+00:00\",\"dateModified\":\"2021-08-17T03:27:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\"},\"wordCount\":593,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Server Usage\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\",\"name\":\"Limit CPU usage of intensive tasks | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2012-11-30T21:29:23+00:00\",\"dateModified\":\"2021-08-17T03:27:38+00:00\",\"description\":\"In this article we'll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren't causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Limit CPU usage of intensive tasks\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Limit CPU usage of intensive tasks | InMotion Hosting","description":"In this article we'll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren't causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/","og_locale":"en_US","og_type":"article","og_title":"Limit CPU usage of intensive tasks | InMotion Hosting","og_description":"In this article we'll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren't causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2012-11-30T21:29:23+00:00","article_modified_time":"2021-08-17T03:27:38+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"Limit CPU usage of intensive tasks","datePublished":"2012-11-30T21:29:23+00:00","dateModified":"2021-08-17T03:27:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/"},"wordCount":593,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Server Usage"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/","name":"Limit CPU usage of intensive tasks | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2012-11-30T21:29:23+00:00","dateModified":"2021-08-17T03:27:38+00:00","description":"In this article we'll discuss how you can limit the CPU usage of an intensive task and spread it out over a longer period of time. This can help ensure that you aren't causing problems of sluggishness on your own website, or affecting other users on the same server while running an intensive task.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/server-usage\/limit-cpu-usage-of-intensive-tasks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Limit CPU usage of intensive tasks"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/488","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=488"}],"version-history":[{"count":5,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/488\/revisions"}],"predecessor-version":[{"id":85249,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/488\/revisions\/85249"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}