Re: [squid-users] question in "cpu_affinity_map" directive

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sun, 27 Oct 2013 14:55:00 -0600

On 10/26/2013 03:29 PM, Ahmad wrote:

> # TAG: cpu_affinity_map
> # Usage: cpu_affinity_map process_numbers=P1,P2,... cores=C1,C2,...
> #
> # Sets 1:1 mapping between Squid processes and CPU cores. For example,
> #
> # cpu_affinity_map process_numbers=1,2,3,4 cores=1,3,5,7
> #
> # affects processes 1 through 4 only and places them on the first
> # four even cores, starting with core #1.
> #
> # CPU cores are numbered starting from 1. Requires support for
> # sched_getaffinity(2) and sched_setaffinity(2) system calls.

> it says that the core start with number 1 !!

Cores are _numbered_ starting with number 1. That means that the very
first core is assigned number 1. The second core is assigned number 2.

AFAICT, there is no standard way to number cores. In some environments,
CPU numbering starts from 0, while in others numbering starts with 1.
Squid uses the latter scheme because it just felt more "natural" to
number the second core as #2 rather than #1. I think this was even
discussed on squid-dev, but I failed to find a reference quickly.

> why i cant user core # 0 ???

You can use the first core. The first core is assigned #1 in the
cpu_affinity_map context.

> can i map a 1 squid process to more than one core ????

Yes, but not using cpu_affinity_map in squid.conf. Use taskset(1)
instead. Eventually, cpu_affinity_map may support mapping algorithms
other than 1:1.

HTH,

Alex.
Received on Sun Oct 27 2013 - 20:55:08 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 28 2013 - 12:00:12 MDT