{"id":9158,"date":"2018-02-14T02:00:43","date_gmt":"2018-02-14T07:00:43","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=9158"},"modified":"2018-02-14T02:00:43","modified_gmt":"2018-02-14T07:00:43","slug":"limiting-the-litespeed-cache-crawler-for-wordpress","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2018\/02\/14\/limiting-the-litespeed-cache-crawler-for-wordpress\/","title":{"rendered":"WpW: Limiting the LSCache Crawler"},"content":{"rendered":"<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-9160\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5.png\" alt=\"WordPress Wednesday: Limiting the LiteSpeed Cache Crawler\" width=\"640\" height=\"320\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5.png 640w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5-600x300.png 600w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Welcome to another installment of <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a>!<br \/>\nToday\u2019s topic is: <strong>Limiting the LiteSpeed Cache Crawler<\/strong><\/p>\n<p><em><strong>Disclaimer<\/strong>: The information contained in this post is accurate for LSCWP v1.9 [<a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/#developers\">release log<\/a>]. If you are using a newer version of the plugin, some details may have changed. Please<a href=\"https:\/\/www.litespeedtech.com\/support\/wiki\/doku.php\/litespeed_wiki:cache:lscwp\"> refer to our wiki<\/a> for the latest!<\/em><\/p>\n<p>When we introduced the <strong>LiteSpeed Cache Crawler<\/strong> in our WordPress plugin last May, we <a href=\"https:\/\/lswp.store\/2017\/06\/21\/wpw-more-about-crawling\/\">told you<\/a> that the crawler has the potential to consume significant system resources, if not configured with efficiency in mind. It was for this reason that we put the on\/off switch in the hands of the hosting providers.<\/p>\n<p>Some hosts wanted the ability to allow their clients the use of a LSCWP crawler, but only if the providers had the ability to set some limits.<\/p>\n<p>We thought that was a great idea, and so today we\u2019re going to talk about the new crawler-specific server variables that we created in response to this request.<\/p>\n<h2>Why Limit the Crawler?<\/h2>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null.jpeg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9162\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null.jpeg\" alt=\"Limiting the LSCache Crawler: Forest Tent Caterpillar Moth\" width=\"1000\" height=\"333\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null.jpeg 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-300x100.jpeg 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-768x256.jpeg 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-600x200.jpeg 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>The settings in LSCWP\u2019s Crawler tab have always been designed to minimize server impact. Site admins are encouraged to configure their crawler to be conservative in its usage of resources. That said, users are free to configure it however they like. Site admins on shared hosting could conceivably use crawler settings that bring a server to its knees if they wanted to, negatively impacting every other site on that server.<\/p>\n<p>With no safeguards in place to protect against the rogue site owner in the second scenario, many shared hosting providers have decided not to take a chance on enabling the crawler.<\/p>\n<p>But now, with these new server variables, <strong>we are giving hosting providers the ability to set some boundaries for the site owners<\/strong>. The idea being, if they can guarantee that no client can hog all of the resources, then there should be enough to go around.<\/p>\n<h2>Exactly What Do These New Variables Limit?<\/h2>\n<p>Currently hosting providers can potentially limit two of the crawler settings that are found in <strong>LiteSpeed Cache &gt; Settings &gt; Crawler<\/strong>.<\/p>\n<h3>Delay<\/h3>\n<p>This setting lets LSCache know how often to send a new request to the server. The longer the delay, the less load there is on the server, but the longer it takes to crawl. LSCache defaults <strong>Delay<\/strong> to 500 microseconds, but site admins may change the number to whatever they like.<\/p>\n<p>The <code>CRAWLER_USLEEP<\/code> variable puts a minimum allowed value on the <strong>Delay<\/strong> field. You can specify a large number, if you want to slow down all of the crawlers on your server and minimize their impact.<\/p>\n<p>For example, if you set <code>CRAWLER_USLEEP<\/code> to <code>1000<\/code> microseconds, then your site admins may set their own crawler delays to any number greater than or equal to 1000. All site crawlers across the server will never be allowed to run faster than 1000 microseconds between requests.<\/p>\n<h3>Server Load Limit<\/h3>\n<p>Server Load Limit keeps the crawler from monopolizing system resources. Once the load reaches this limit, the crawler will be terminated rather than allowing it to compromise server performance. LSCache defaults <strong>Server Load Limit<\/strong> to <code>1<\/code>, which is fairly conservative, but site admins have the ability to crank it up as high as they like.<\/p>\n<p>With the following server variables, hosting providers can prevent site owners from setting the limit too high.<\/p>\n<ul>\n<li><code>CRAWLER_LOAD_LIMIT<\/code> sets a default value for the <strong>Server Load Limit<\/strong> field.<\/li>\n<li><code>CRAWLER_LOAD_LIMIT_ENFORCE<\/code> sets a maximum allowed value on the <strong>Server Load Limit<\/strong> field. While the previous variable is more of a suggestion, this is an enforced maximum.<\/li>\n<\/ul>\n<p>For example, if you set <code>CRAWLER_LOAD_LIMIT<\/code> to <code>3<\/code>, then 3 will override the LSCache default of 1. If a site admin enables crawling without changing any of the settings, that site\u2019s <strong>Server Load Limit<\/strong> will be <code>3<\/code>.<\/p>\n<p>If you use CRAWLER_LOAD_LIMIT by itself, site admins are still free to change it to whatever they like. To prevent this behavior, and set a maximum Server Load Limit, you would use <code>CRAWLER_LOAD_LIMIT_ENFORCE<\/code>. Set it to <code>6<\/code>, for example, and the site owners will not be allowed to exceed a <strong>Server Load Limit<\/strong> value of <code>6<\/code>.<\/p>\n<h2>How to Limit the Crawler<\/h2>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1.jpeg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9164\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1.jpeg\" alt=\"Limiting the LSCache Crawler: Forest Tent Caterpillar Moth\" width=\"1000\" height=\"333\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1.jpeg 1000w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1-300x100.jpeg 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1-768x256.jpeg 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-1-600x200.jpeg 600w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p>To use the server variables, add them one-per-line to the appropriate configuration file. For example:<\/p>\n<pre>CacheEngine on crawler\n\nSetEnv CRAWLER_USLEEP 1000\nSetEnv CRAWLER_LOAD_LIMIT_ENFORCE 6\n\n<\/pre>\n<p>The variables can be used server-wide or on a virtual-host basis, and are completely optional. We\u2019ve incorporated the server variable instructions into our <a href=\"https:\/\/www.litespeedtech.com\/support\/wiki\/doku.php\/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler\">Enabling the Crawler instructions<\/a>. Check that out to get specific directions for your control panel, for LiteSpeed native WebAdmin, or for no control panel at all.<\/p>\n<p><strong>Hosting providers<\/strong>, we hope that these new variables will allow some of you to open up crawler usage to more of your clients!<\/p>\n<p><strong>Site owners<\/strong>, if you\u2019ve been unable to persuade your hosting provider to enable crawling, maybe this new ability to limit crawler impact will change their minds! Feel free to share this blog post with your host, or share a link to <a href=\"https:\/\/www.litespeedtech.com\/support\/wiki\/doku.php\/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler\">the crawler setup page on our wiki<\/a>.<\/p>\n<p>&#8212;<\/p>\n<p>Have some of your own ideas for future <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\">WordPress Wednesday<\/a> topics? Leave us a comment!<\/p>\n<p>Don\u2019t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:<\/p>\n<ul>\n<li>Subscribe to the <a href=\"http:\/\/blog.litespeedtech.com\/tag\/wordpress-wednesday\/feed\/\">WordPress Wednesday RSS feed<\/a><\/li>\n<li>Download <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\">LiteSpeed Cache for WordPress plugin<\/a><\/li>\n<li>Learn more about the plugin <a href=\"https:\/\/www.litespeedtech.com\/products\/cache-plugins\/wordpress-acceleration\">on our website<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Some hosts wanted the ability to allow their clients the use of a LSCWP crawler, but only if the providers had the ability to set some limits. Here&#8217;s how we implemented that.<\/p>\n","protected":false},"author":1,"featured_media":9160,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[81,316,317],"class_list":["post-9158","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cache","tag-crawler","tag-wordpress","tag-wordpress-wednesday"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2018\/02\/null-5.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=9158"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9158\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/9160"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=9158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=9158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=9158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}