poll vs epoll performance

Anatoly Vorobey mellon@pobox.com
Sun, 16 Nov 2003 17:33:36 +0200


On Sun, Nov 16, 2003 at 02:43:28PM +0000, Richard Jones wrote:
> Hi all,
> we're running memcached on a couple of xeon boxes, using poll on both, epoll 
> isnt installed
> 
> i noticed one php page making around 400 induvidual GET requests to memcached, 
> total memcached time take was 0.5 seconds. all requests were cache hits.
> 
> how many memcached requests might a typical LJ/slashdot/any webpage make, and 
> how long does it take to process them all? I'm interested in ways to reduce 
> that 0.5 seconds
> 
> each request was fetching a fairly small php object. (100mbit lan) i'd like to 
> know if this is par for the course, or would the time taken decrease a lot if 
> we were using epoll?
> 
> what about using get_multi so all keys are passed in an array, this shouldnt 
> make any speed difference, because the socket connection is already open so 
> it is not cutting down on any connection overhead..right?

You should definitely use get_multi and not many gets for fetching many 
keys you already know you should fetch. With individual gets, the next 
one isn't sent until the previous one returns its value. So you're 
wasting time on assembling and sending small IP packets, then waiting 
for the reply. With one multi_get, you're sending large packets, and 
you're sending all of them together not waiting for memcached to reply, 
then you get one large reply.

Inside memcached the difference is indeed small, but you'll be cutting
down a lot of client and network overhead by using get_multi.

--
avva