benchmark for single-threaded vs. multi-threaded memcached
sgrimm at facebook.com
Fri May 18 05:45:04 UTC 2007
Given that goal, testing memcached against spcached is even less likely
to tell you much, because differences between the way the two
applications work internally may well be much more significant than any
performance differences introduced by the particulars of the threading
model. So if you see one of them is faster than the other, all you can
really conclude is that one of them is faster than the other, but you
can't infer anything about whether a half-sync/half-async thread pool is
good or bad for performance. Various people have spent quite a lot of
effort optimizing memcached, and I suspect spcached hasn't had similar
attention paid to its internal bottlenecks and performance characteristics.
Just my opinion. (And sorry I didn't realize your goal or I would have
replied to this over on the libevent list instead.)
Well, actually, to make this relevant to the memcached list while
further illustrating what I mean, I will tell people a few of the things
we (Facebook) tried and ended up rejecting. We tried replacing the
hashtable with a Judy tree and with a trie; both of those ended up being
slower than the hashtable by a fair amount (theoretically a trie should
be faster given that it's not doing the math to compute a hash value,
but it turned out to be slower because walking the trie involved more
CPU cache misses.) My initial threading implementation was a worker-pool
model that farmed out individual requests to worker threads, but the
poor interaction between threads and libevent caused us to make three or
four extra system calls per request which again killed performance and
drove CPU consumption way up.
The overall point being that memcached -- while there is undoubtedly
still plenty of room for improvement -- is tuned to the point where
adding a few system calls per request, or slightly increasing the number
of out-of-cache memory accesses, has a measurable impact on throughput.
Unless you're measuring it against another server that has been
similarly tuned, any difference you see is more likely to be due to that
tuning than to any inherent difference between the two programs.
> Hi, Steven Grimm
> I agree with you. I sorry for not to explain my purpose very clear.
> My purpose is to compare single-threaded event-driven program
> vs. half-sync/half-async thread pool program. The both are based on libevent.
> Best regards£¬
More information about the memcached