stats in binary protocol

Toru Maesaka tmaesaka at
Fri Jun 27 08:06:58 UTC 2008

Hi all,

So I've been working on implementing the stats command over binary
protocol the last couple of days and came across few questions that I
would like to ask. My approach is based on the discussion from the
last hackathon. Heres a paragraph from Dustin's notes:

A stats command is issued with a single string parameter, and the
server returns multiple responses, each containing a key, and a string
value.  A terminating packet indicates the server has nothing more to
say.  [We didn't really talk about the details of this, but I'd
recommend terminating with a stat with a 0 length key and 0 length

What I would like to know is:

(1) Since the server sends back each row of an arbitrary stats output
at a time to the client, does this mean a given client should be able
to ask for any specific information? (e.g. a client could _only_ ask
for the pid of the server). This would make my life a little tricky

(2) What should we do if a key wasn't contained in the request? I'm
thinking that this case should be treated the same as "stats\r\n" in
the ascii protocol. Is there any objections...?

(3) What is the motivation behind sending row at a time?, when we
could serialize the entire output of an arbitrary stats output and
send it back to the client, like the current ascii approach (output
data is fairly small afterall). I'm asking this since this approach
would be relatively easy to pull off.

It would clear my mind a lot if I could get these questions answered :-)


More information about the memcached mailing list