]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/squid/templates/default/squid.conf.erb
squid: tune number workers cpu
[chef.git] / 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 -%>