multithreaded version of memcached on solaris?

Steven Grimm sgrimm at
Tue Nov 28 07:21:04 UTC 2006

The code as it stands now is targeted at 4-CPU machines since that's 
what we use at our data centers. My expectation is that you will get 
diminishing returns beyond that, but I have not actually tried it. 
Depending on your system architecture and your particular traffic 
patterns, you might do better than that; it all depends on how much time 
memcached is spending manipulating the shared data structures. Quite a 
lot of the server's CPU time is spent in command parsing and response 
writing, which is completely parallelizable.

If you want to run it on a big machine and you don't mind a little 
hacking, the obvious first thing to try, as noted at the bottom of 
doc/threads.txt, is to move the key hashing up to a higher level of the 
code. It happens at a very low level right now, and the lock that's held 
at that point that will almost certainly be your bottleneck at higher 
CPU counts.

One approach that people use with the single-threaded version is still 
applicable to the MT one: run multiple instances on one machine. The 
upside is that that scales as far as you want with no code changes; the 
downside is that you might accumulate more TCP sessions than you'd like 
if you're using persistent connections on your clients. With the MT 
version you should be able to get away with roughly a quarter as many 
instances as with the ST version.


spider wrote:
> I had a look on the code. have you been able to scale it beyond 4 cpus?

More information about the memcached mailing list