Trond Norbye wrote:

On 16. sep.. 2009, at 15.57, Jason Priebe wrote:


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.


On Solaris you can bind a process or a thread to a certain CPU by using the pbind command.

The linux version is taskset.

If you want to change the affinity of a particular thread, you have to use the pseudo-process id of the thread.

Regards,
Jaime.

Reply via email to