Thrift vs. Protocol Buffers
floatingsun.net
floatingsun.net
This was very helpful while writing an iPhone application that records audio and sends it to a server for voice recognition processing. Thrift allowed me to setup the iPhone client and the Windows/C# server in only a few lines of code. Protocol Buffers required that I establish a socket connection, send the audio data across, and then reassemble the data on the server side. Not the worlds most difficult problem, but being new to Objective-C at the time it was a bit tricky. I wish I had known about Thrift when I was building my initial implementation based on Protocol Buffers.
What was the payload like that made this a better fit?
On the other hand, generated code from Protobuf allows you to slide in an asynchronous callback function (although yes, you have to write like 50 lines of code to build an RPC implementation).
I can't speak for other languages, but given Thrift's inflexibility with Python, I suspect the situation is at least as bad for less common languages.
Basically, they're both nested type/length/value data formats with primitives for numerics, strings, etc with an human readable description language and toolsets to auto-generate language types + (de)serialisers etc.
Given that the ASN.1 toolset exists (even if a little dusty, SNMP and X.509 keep it alive) I don't see why google bothered to re-implement.
The FAQ: http://code.google.com/apis/protocolbuffers/docs/faq.html mentions ASN.1 but it's main argument (being tied to a particular form of RPC) doesn't apply to ASN.1.
I've also wondered why so many re-inventions of the wheel what is basically ASN.1 and did some research:
The main reason which I found was that, according to developers, for reimplementation ASN.1 was too complex to get right (it has a big legacy) and that the current toolsets had or not the right license, not the right languages, etc.
Also, they didn't like the ASN description syntax.
And while gobs are (by design) Go-centric, there are already implementations in C for example: http://code.google.com/p/libgob/
And Go also has the rpc package, which uses gobs (but can also use json or other encodings): http://golang.org/pkg/rpc/
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
python setup.py build_ext
It's "EXPERIMENTAL", but it seems to work well.It is not ready for production use yet. Please help us by testing and submitting bug reports & patches!
We have a java backend service that gets thousands of requests per second per node and where latency is of upmost importance. We tested thrift for communication between the backend service and the front end web code, however we saw an increase in failed requests and latency compared to a server written using netty.
For us, using netty and Protocol Buffers works much better, but maybe we were using Thrift wrongly.
That said, we are starting to miss a Javascript protobuf implementation. There is a lot of binary data to serialize across the client/server boundary and not all of it requires a custom format. It would be nice to just drop in server side protobufs and have them work seamlessly on the client.
I do understand the criticism about the missing RPC library but I've always found that you need to write your own anyway.
So we switched to Thrift and whole FB stack with HipHop and Scribe and we're thrilled. Documentation is a problem just at the beginning when setting up the stack. Everything else later is self explanatory.
[citation needed] (seriously, I'm interested)
XML seems far more popular (in the sense of market-share/adoption, not in the sense of being liked).
Thinking further, startups might be early-adopters of new technology, that will eventually become mainstream. But it doesn't seem to be a reliable predictor, since many (most) new technologies don't reach critical mass before being replaced by the next new thing. eg. ASN.1 binary serialization format. http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One