{"id":1613,"date":"2011-02-25T00:06:57","date_gmt":"2011-02-25T00:06:57","guid":{"rendered":"http:\/\/wiki.freeiz.com\/?p=1613"},"modified":"2016-08-09T12:06:31","modified_gmt":"2016-08-09T12:06:31","slug":"how-to-increase-squids-cache-directory-swap-size","status":"publish","type":"post","link":"https:\/\/wiki-see.info\/wp\/2011\/02\/25\/how-to-increase-squids-cache-directory-swap-size\/","title":{"rendered":"How To Increase Squid\u2019s Cache Directory Swap Size"},"content":{"rendered":"<p><span style=\"color: #000000;\">At times, granted a high-end server capacity and resources with large disk and memory capacity,<br \/>\nincrease <a title=\"squid\" href=\"http:\/\/techgurulive.com\/category\/howtos-and-tutorials-on-squid\/\">squid<\/a>\u2019s  disk cache size is highly advisable. With higher disk cache size, you  provide a higher<br \/>\namount of disk space to be used by squid on caching web  files<\/span>.<\/p>\n<p><span style=\"color: #000000;\"><strong>Increase Squid Cache Directory Swap Size<\/strong><\/span><\/p>\n<p><span style=\"color: #000080;\">With default Squid rpm installation, the default value of squid cache directory swap size is set to 100MB.<br \/>\nHaving a large disk <a title=\"storage\" href=\"http:\/\/techgurulive.com\/category\/free-software-downloads\/storage-free-software-downloads\/\">storage<\/a> would be efficient to store a larger directory swap size for squid to use.<\/span><\/p>\n<p><span style=\"color: #000080;\">Simply edit \/etc\/squid\/squid.conf and find the cache directory squid directive<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>cache_dir ufs \/var\/spool\/squid 100 16 256<\/strong><\/span><\/p>\n<p><strong><span style=\"color: #000080;\">\/var\/spool\/squid<\/span><\/strong> <span style=\"color: #000000;\">is the directory folder location where squid will use to swap cached web files<\/span>.<\/p>\n<p><strong><span style=\"color: #000080;\">100<\/span><\/strong> <span style=\"color: #000000;\">the first number is the amount of disk space in MB to be used by squid for caching directory<\/span>.<strong><span style=\"color: #000080;\"><br \/>\n16 <\/span><\/strong> <span style=\"color: #000000;\">is the number of first-level sub directories which will be created under the \u2018Directory\u2019<\/span>.<br \/>\n<strong><span style=\"color: #000080;\">256<\/span><\/strong> <span style=\"color: #000000;\">is the number of second-level sub directories which will be created under each first-level directory<\/span>.<\/p>\n<p><span style=\"color: #000000;\"><strong>To verify your disk and partition sizes, simply<\/strong><\/span><\/p>\n<p><span style=\"color: #800000;\"># df -ah<\/span><\/p>\n<p><em><span style=\"color: #000000;\">giving you a similar lines<\/span><\/em><\/p>\n<p><span style=\"color: #000000;\">\/dev\/sda3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 49G\u00a0 4.5G\u00a0\u00a0 42G\u00a0 10% \/var<br \/>\n\/dev\/sda2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 387G\u00a0\u00a0 18G\u00a0 350G\u00a0\u00a0 5% \/home<br \/>\n\/dev\/sda1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 99M\u00a0\u00a0 12M\u00a0\u00a0 83M\u00a0 13% \/boot<\/span><\/p>\n<p><span style=\"color: #000000;\">From default squid installation, cache dir is physically dumped to \/var directory by default.<br \/>\nNow,  considering a server with high space, say 40GB free disk partition  size, you could reconfigure<br \/>\n<span style=\"color: #000080;\">squid cache_dir<\/span> to a value of<\/span><\/p>\n<p><span style=\"color: #000080;\">cache_dir ufs \/var\/spool\/squid 2000 32 512<\/span><\/p>\n<p><span style=\"color: #000000;\">That is <\/span><span style=\"color: #800000;\">2GB<\/span> <span style=\"color: #000000;\">of cache directory for squid to use with 512 second-level directory under the first level of 32.<\/span><\/p>\n<p><span style=\"color: #000000;\">Save, exit and create the cache directory<\/span>.<\/p>\n<p><span style=\"color: #000000;\"><strong>Stop Squid first<\/strong><\/span><\/p>\n<p># <span style=\"color: #800000;\">service squid stop<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>Recreate Squid Cache Directory<\/strong><\/span><\/p>\n<p># <span style=\"color: #800000;\">squid -z<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>Start Squid Service<\/strong><\/span><\/p>\n<p># <span style=\"color: #800000;\">service squid start<\/span><\/p>\n<p><span style=\"color: #000000;\">This setup would nicely suit a large and regular internet user infrastructure setup.<\/span><\/p>\n<p><span style=\"color: #000000;\">All done<\/span>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At times, granted a high-end server capacity and resources with large disk and memory capacity, increase squid\u2019s disk cache size is highly advisable. With higher disk cache size, you provide a higher amount of disk space to be used by squid on caching web files. Increase Squid Cache Directory Swap Size With default Squid rpm [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[643],"class_list":["post-1613","post","type-post","status-publish","format-standard","hentry","category-linux","tag-squid"],"_links":{"self":[{"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/posts\/1613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/comments?post=1613"}],"version-history":[{"count":1,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/posts\/1613\/revisions"}],"predecessor-version":[{"id":4888,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/posts\/1613\/revisions\/4888"}],"wp:attachment":[{"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/media?parent=1613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/categories?post=1613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki-see.info\/wp\/wp-json\/wp\/v2\/tags?post=1613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}