set_multi() and delete_multi()

Steven Grimm sgrimm at facebook.com
Fri Mar 9 20:46:18 UTC 2007


The server-side CPU cost of processing a two-key get request is MUCH 
lower than processing two single-key requests because you only have to 
run through the parser and (usually) the libevent code once. Don't 
remember the exact ratio off the top of my head but it's pretty steep, 
something in the neighborhood of a 10-key get request taking only 2x the 
CPU time of a 1-key request.

This would be less of an issue with a well-designed binary wire protocol 
that didn't require any parsing at all (though you'd still see some 
difference due to having to wake up for input on each request), but 
right now you can save significant amounts of CPU time on the memcached 
server by bundling your gets up into as few requests as possible. So I'm 
glad multi-gets aren't just a series of streamed single-gets.

-Steve


Brad Fitzpatrick wrote:
> Yup.
>
> It's actually kinda stupid get is magic and we didn't just make all
> clients pipeline multi-get from the start.  But get is kinda common, so it
> gets to be special.
>
>
> On Fri, 9 Mar 2007, Paul Lindner wrote:
>
>   
>> On Fri, Mar 09, 2007 at 02:53:35PM +0300, Michael wrote:
>>     
>>> Hi.
>>>
>>> Function get_multi() is very useful and helps save a lot of resources.
>>> What about set_multi() and delete_multi() in memcached API? I think,
>>> they will be very useful too.
>>>       
>> set/delete_multi() can (and should?) be implemented in the client.
>> The client can transmit multiple delete/set requests in a stream and
>> then wait for the results to come back if I'm not mistaken.
>>
>> --
>> Paul Lindner        ||||| | | | |  |  |  |   |   |
>> lindner at inuus.com
>>
>>     



More information about the memcached mailing list