Hi Folks,

Running HAProxy-1.7.8 on FreeBSD-11.0. Working with nbproc=2 to separate HTTP and HTTPS portions of the config.

Given the following config:

global
        nbproc 2
        cpu-map 1 2-8
        cpu-map 2 7-14

After starting HAProxy, there are, as expected, two processes running.

99133  -  Ss         0:16.36 /usr/local/sbin/haproxy -q ...
99134  -  Ss         0:16.36 /usr/local/sbin/haproxy -q ...

However, the CPU affinity does not appear to be set on either process - both are configured with a full mask
# cpuset -g -p 99133
pid 99133 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
# cpuset -g -p 99134
pid 99134 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

I do see the expected call to cpuset_setaffinity on line 2018 of src/haproxy.c:

#ifdef USE_CPU_AFFINITY
                if (proc < global.nbproc &&  /* child */
proc < LONGBITS && /* only the first 32/64 processes may be pinned */ global.cpu_map[proc]) /* only do this if the process has a CPU map */
#ifdef __FreeBSD__
cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(unsigned long), (void *)&global.cpu_map[proc]);

Is this behavior expected? Should one need to manually run the cpuset(1) program after starting HAProxy?

Best,
Mark Staudinger

Reply via email to