<HTML>
<HEAD>
<TITLE>Re: binary protocol motivations</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>For the record, my motivation for a binary protocol was not computational efficiency but more efficient I/O, especially for large sets of small keys with small values, AND to reduce code complexity. &nbsp;The problem with the existing protocol is not so much that it is ASCII as it is that it is inconsistently structured. &nbsp;There is no explicit length for error or stats messages. &nbsp;Replies to &#8220;incr&#8221; and &#8220;decr&#8221; ops are raw digits with no preceding fixed-length token. &nbsp;The special case code to handle these cases is more complicated than common messages, and, in the case of errors and stats, very difficult to test. &nbsp;A well-formed binary protocol allows us to handle the packing and unpacking of wire messages with very little special case code and make it possible to write regression tests can cover all possible scenarios.<BR>
<BR>
The addition of a key &#8220;id&#8221; is really a big win for reducing network traffic. &nbsp;IIRC that was Dustin&#8217;s suggestion.<BR>
<BR>
<BR>
On 11/12/07 12:17 AM, &quot;Dustin Sallings&quot; &lt;dustin@spy.net&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:10.0px'><BR>
On Nov 11, 2007, at 23:31, Axel wrote:<BR>
<BR>
&gt; Can someone provide a quick summary/bullet points of the motivations<BR>
&gt; behind providing a binary API, or direct me to a web page or mailing<BR>
&gt; list message that lists motivations? &nbsp;(I tried searching my folder for<BR>
&gt; this mailing list, but references to the binary protocol abound).<BR>
<BR>
<BR>
&nbsp;The primary goal, as I understand it, is to reduce parsing overhead &nbsp;<BR>
which has been shown to be computationally expensive in certain &nbsp;<BR>
installations.<BR>
<BR>
&nbsp;We also ended up with a protocol that is more simple to implement &nbsp;<BR>
(although my perspective may be skewed after having written servers in &nbsp;<BR>
c and python and clients in python and java) and more efficient on the &nbsp;<BR>
wire (we don't ever return keys for get requests, for example).<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="2"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:10.0px'><BR>
</SPAN></FONT></FONT>
</BODY>
</HTML>