]> git.openstreetmap.org Git - chef.git/commitdiff
squid: tune number workers cpu
authorGrant Slater <git@firefishy.com>
Mon, 25 Nov 2019 21:08:23 +0000 (21:08 +0000)
committerGrant Slater <git@firefishy.com>
Mon, 25 Nov 2019 21:08:23 +0000 (21:08 +0000)
cookbooks/squid/templates/default/squid.conf.erb

index 114762f8c1dc1a6550c484235ad2e29a3452375d..bc6b1aff05642245c4c5de44e3cfa48546199b1c 100644 (file)
@@ -6,7 +6,8 @@ visible_hostname <%= node.name %>
 cache_mem  <%= node[:squid][:cache_mem] %>
 <% if node[:squid][:version] > 2 -%>
 
-workers <%= node[:cpu][:total] %>
+workers <%= [ node[:cpu][:total] - 2, 1 ].max.ceil %>
+cpu_affinity_map process_numbers=<%= (1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %> cores=<%=(1..[ node[:cpu][:total] - 2, 1 ].max.ceil).to_a.join(',') %>
 
 error_log_languages off
 <% end -%>