Giving up on FaceBook’s Thrift

I’m working on some commercial software (implemented in Java) that needs to expose an API that a wide variety of programming languages can interface with over the network.

A few months ago my attention was drawn to FaceBook’s Thrift framework, a tool that allows you to define an API in a language-neutral way, and which will then generate code in a variety of languages (C, Java, Python, Ruby, etc) to communicate with the API, either as a client or a server. Because Thrift uses a compact binary protocol, it promises to be more efficient than approaches like XML-RPC, SOAP, or JSON-RPC. Also, because it generates both client and server code automatically, the likelihood of bugs in how the client and server communicate is greatly reduced.

Thrift’s documentation is dismal, and what little of it there is, is hard to find. There is an example API definition file on the Thrift homepage, and this serves as an adequate explanation of how to write one because it is well commented, but still, some proper documentation would be nice here.

Once you’ve created your API definition, and actually want to integrate the bindings that Thrift automatically generates into your code, the lack of documentation becomes a much bigger problem. I stumbled around blindly for quite a while before discovering that some example files are included with the Thrift source code in a subdirectory. Of course, there isn’t a single comment in any of the example code, at least the Java code I looked at. This just isn’t good enough – even if Thrift had never been released to the public, its amazing that whoever managed the project internally at Facebook didn’t insist that they provide at least some documentation.

So the next challenge is that I knew at least one user of this code required C# bindings. These aren’t present in the current Thrift release, but I discovered that code to support this had been committed back in January, so I went ahead and attempted to build the latest Thrift code directly from their Subversion repository.

And here I ran into yet more roadblocks, I couldn’t even get the ./configure script to run (this is what checks all the dependencies before you begin compiling). I emailed Thrift’s mailing list, and here I have to say that those on the list, mostly Facebook employees from what I could see, were extremely responsive, often replying within minutes. Their answers weren’t always as direct as I would have liked, on one or more occasion they just explained what the problem was, rather than telling me how to solve it.

Nonetheless, within a few hours I’d resolved the ./configure script issue, and ran into another issue during compilation. Again, after a few (very promptly answered) emails to the list, I was able to compile the thing, and generate the C# bindings I needed. Of course, there weren’t even example files explaining how to use the C# bindings, and it later transpired that they would only work with .NET 3.x – this was a dealbreaker for the user that needed the C# bindings in the first place. Groan.

Anyway, so after all of these issues, I’ve given up on Thrift, and will probably create a simple REST interface using something like Restlet.

To summarize my Thrift experience:

Concept: A+
Simplicity: B-
Documentation: F
Support B+
Maturity: F
Overall: D

Leave a Reply

Your email address will not be published. Required fields are marked *