Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Allright so I'm about to upgrade my box (with 2k external ips) to the latest squid (3.3.x) since my old version do not take any advantage of the multi-core processors.

While researching on the workers I found a discussion where someone says:

Use cpu_affinity_map in squid.conf. Leave Cpu0 "for the OS". Be careful not to put two busy workers on sibling hyper-cores. This is just a sketch of an optimization algorithm. There are many details that depend on your setup.

I also understand that it's best to use as many workers as you have CPUs:

FWIW, we usually see best performance results when using cpu_affinity_map with 1:1 mapping between workers and cores (which effectively disables those complex algorithms as far as Squid workers are concerned).

My question's that physical CPUs? My box reports 8 cpus but only 2 physical shown when I run cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l so that means 2 workers?

If I put 2 workers on 2 physical CPUs how does Leave Cpu0 "for the OS" fits? This means I set only 1 worker for cpu1 while OS uses cpu0?

P.S. I know about cpu afinity. I just need a clarification about how to find out exactly how many workers I can use before I lose poerformance.

share|improve this question
What CPU do you have? – David Schwartz Aug 1 '13 at 2:33
Intel(R) Xeon(R) CPU E5506 @ 2.13GHz but I wouldn't want an answer based on this cpu as I will need this for other machines as well. – Romeo Mihalcea Aug 1 '13 at 2:37
you can try the lscpu if available to you for listing the cpus. I sometimes find that output easier to read. – Petter H Aug 1 '13 at 9:16
up vote 1 down vote accepted

You have two Xeon E5506 CPUs with 8 cores total. The E5506 has no hyper-threading. You could run seven workers and still have an free core for the OS.

share|improve this answer
So I basically have to avoid using the whole number of CPUs when I have hyper threading CPUs? – Romeo Mihalcea Aug 1 '13 at 2:45
@RomeoMihalcea: According to some random guy in a conversation that you quoted. – David Schwartz Aug 1 '13 at 2:57
cat /proc/cpuinfo | egrep "core id|physical id" | tr -d "\n" | sed s/physical/\\nphysical/g | grep -v ^$ | sort | uniq | wc -l found this to show the cores after removing the hyperthreading ones. Thanks. I'm left with testing things out from now. – Romeo Mihalcea Aug 1 '13 at 3:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.