binary protocol notes from the facebook hackathon
chip at corelands.com
Tue Jul 10 16:38:37 UTC 2007
Brad Fitzpatrick wrote:
> COMMANDS: (for cmd byte)
> get - single key get (no more multi-get; clients should pipeline)
> getq - like get, but quiet. that is, no cache miss, return nothing.
> Note: clients should implement multi-get (still important for
> reducing network roundtrips!) as n pipelined requests, the
> first n-1 being getq, the last being a regular
> get. that way you're guaranteed to get a response, and
> you know when the server's done. you can also do the naive
> thing and send n pipelined gets, but then you could potentially
> get back a lot of "NOT_FOUND!" error code packets.
This is missing the discussion about the GETQ putting the server into
'cork' mode, and any non-GETQ would uncork it. This would allow the
server to optimize its own IO without nearly as much pain.
Also, as a client author, I really would prefer just having a NOOP or
ECHO command at end of the bulk GETQ, rather than having to special case
the last request. I guess I could just send a GET for a stats key or
something, but that seems weird.
More information about the memcached