<span class="hps" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">protobufs, thrift</span><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); "> </span><span class="hps atn" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">and other "</span><span class="" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">human-readable</span><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); "> </span><span class="hps" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">binary protocol</span><span class="" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">" is the best</span><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); "> </span><span class="hps" style="color: rgb(51, 51, 51); font-family: arial, sans-serif; font-size: 16px; background-color: rgb(245, 245, 245); ">choice,small message packets,decoding and encoding fast speed is fast.</span><br>
<br><div class="gmail_quote">2011/12/1 envelopes envelopes <span dir="ltr"><<a href="mailto:sunwood360@gmail.com">sunwood360@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<p>I remember there is also messagepack that supports erlang, It has good performance.<br></p>
<p>In addition, there is Avro.</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Nov 30, 2011 3:07 PM, "Anthony Molinaro" <<a href="mailto:anthonym@alumni.caltech.edu" target="_blank">anthonym@alumni.caltech.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On Fri, Nov 25, 2011 at 04:18:09PM +0100, Joe Armstrong wrote:<br>
> I guess you all know about Chinese whispers.<br>
><br>
> You send a whispered message round a circle and see if you get the same<br>
> message back.<br>
><br>
> The computer variant is as follows:<br>
><br>
> Send a complex data structure round a circle, and see if you get the same<br>
> message back.<br>
<br>
Sorry I'm late to the party with this one, but was out of town for a bit.<br>
<br>
I have used thrift, protobuffs and lwes to do binary multi-language<br>
message exchange, which is not quite the whispers problem but close.<br>
They all contain serializers and deserializers and each support different<br>
sorts of things.<br>
<br>
Thrift is mainly meant for RPC, so if all you want is a binary serialization<br>
format, it's a bit tricky (mostly in erlang, less so in java), in that you<br>
have to create a memory serializer and construct the terms then do a<br>
term_to_binary on them, to get a binary you could do what you want with.<br>
On the other hand it supports many languages (include erlang and javascript),<br>
and several protocols (sockets and http being the most common).  It can have<br>
fairly complex structures like maps (which become dict's in erlang), lists,<br>
different sized ints, floats, etc.<br>
<br>
Protobufs also off fairly complex structures (although not maps, you sort of<br>
have to do those yourself with repeated structures which will become lists<br>
of records, so not quite as useful), as well as strings, ints, floats and<br>
binary data.  It does not include any RPC based mechanism, and you basically<br>
get serializers/deserializers which get/give binaries, so you can use it<br>
with whatever you want.  Riak uses this as its faster interface via a socket<br>
and I've implemented server to server communication over HTTP which is<br>
easy.<br>
<br>
LWES (<a href="http://lwes.github.com/" target="_blank">http://lwes.github.com/</a>) is a system and protocol I first developed<br>
in 1998 and which was open sourced in 2008.  It's mostly meant for passing<br>
maps in a fire and forget fashion over UDP (or multicast UDP), it's a bit<br>
bulkier on the wire than thrift and protobuffs as the serialization format<br>
is self describing (key names are sent along with values).  It also only<br>
has support in java for floats and arrays (but those will probably make<br>
their way into the other languages as time permits).  It currently<br>
has native bindings for C, erlang, java, and .Net, as well as SWIG based<br>
bindings for perl, python and ruby.  It's a great system for quickly<br>
passing maps between different programming languages where you can afford<br>
to loose some data here or there.  Also, unlike thrift/protobuff it does<br>
not require any precompilation of modules.  While we don't have a javascript<br>
version yet, we may be developing one soon (although it most likely won't<br>
be able to do UDP from a javascript client which is unfortunate).  LWES<br>
is extremely stable and has been in production systems serving trillions<br>
of events for almost 13 years (every penny ever made by Goto/Overture/Yahoo's<br>
search advertising system was via lwes).<br>
<br>
I've used all three of these systems in production web systems so can attest<br>
that they all work and at large scale (ten's of thousands to hundred's of<br>
thousands of requests per second).<br>
<br>
I've not used Bert, BSON, Avro, MessagePack or Etch all of which do<br>
similiar things but offer slightly different feature sets.<br>
<br>
Hope that helps,<br>
<br>
-Anthony<br>
<br>
--<br>
------------------------------------------------------------------------<br>
Anthony Molinaro                           <<a href="mailto:anthonym@alumni.caltech.edu" target="_blank">anthonym@alumni.caltech.edu</a>><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>ÎÒµÄblog<br><a href="http://blog.sina.com.cn/xingsen">http://blog.sina.com.cn/xingsen</a><br>