We want to update an older memcached server that uses four instances
per server, each listening to a different port, and each using a
different processor.

We would like to get rid of this hacky implementation and just use 4
threads.  But when I enable the multithreading, it seems that the
threads all go to a single CPU.

See the top output below (the "P" column right before the "COMMAND"
column is the processor number).  It's pretty clear that Cpu3 is doing
most of the work, as it has about 80% idle time, with the others
nearly 100% idle.

I'm guessing that the threads are spawned only when the memcached
process is started, so they're going to stay where they are.

Is there any way to force them to each use a different processor?
Thanks for any advice.

top - 09:23:22 up  4:09,  1 user,  load average: 0.09, 0.16, 0.18
Tasks: 130 total,   1 running, 129 sleeping,   0 stopped,   0 zombie
Cpu0  :  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,
0.0%si,  0.0%st
Cpu1  :  0.0%us,  0.3%sy,  0.0%ni, 99.7%id,  0.0%wa,  0.0%hi,
0.0%si,  0.0%st
Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,
0.0%si,  0.0%st
Cpu3  :  1.3%us,  7.6%sy,  0.0%ni, 83.7%id,  0.0%wa,  1.3%hi,
6.0%si,  0.0%st
Mem:   2059560k total,  1860344k used,   199216k free,    77008k
buffers
Swap:  2031608k total,        0k used,  2031608k free,  1341024k
cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  P
COMMAND
 3582 nobody    15   0  310m 260m  604 S    4 12.9   4:26.84 3
memcached
 3585 nobody    15   0  310m 260m  604 S    3 12.9   4:24.56 3
memcached
 3584 nobody    15   0  310m 260m  604 S    2 12.9   4:42.19 3
memcached
 3583 nobody    15   0  310m 260m  604 S    1 12.9   4:29.27 3
memcached

Jason Priebe
CBC New Media Group

Reply via email to