At the beginning of this week we began to work on our backlog of improvements for this service. In working on these improvements, I realized that the Thrift bindings for Erlang were written as a fairly close translation of the bindings in object oriented languages, to the point of an OOP emulation layer (
thrift_oop_server
). This resulted in a lot of code that was both confusing for developers to read through and inefficient for the Erlang VM to execute.Since Erlang is quick to write, I spent the last couple of days rewriting the bindings, and have the new version online in a git repository. Here's the list of notable new features:
- Improved idiomatic style - the whole thing is more "Erlangy" -- there are less gratuitous processes, and things are named
thrift_binary_protocol
rather thantBinaryProtocol
- Improved performance - as a result of ditching the OOP layer, the new bindings are at least 5x faster than the old.
- More robust code generation - the old version generated broken code from the ThriftTest.thrift file in the repository. The new one passes the tests.
- Bug fixes - for example, the old version did not properly serialize/unserialize
double
s - No unexpected crashing processes - the old thrift bindings crashed at the end of every connection when the client disconnected. The new version only crashes when something goes wrong
Hopefully we'll be able to get these new bindings merged upstream in the next couple of weeks. But if you use Erlang and Thrift, please check it out and try it on your project. And if you don't use Erlang and Thrift, it may be worth writing a quick server to see how useful it really is!
3 comments:
Hello,
The http://thrift-git.thruhere.net/gitweb/?p=thrift.git;a=summary repository isn't accesible.
Regards.
Hi,
These erlang bindings are now the standard erlang bindings for thrift available in trunk or the newest release. See http://incubator.apache.org/thrift/
-Todd
First of all I'd like to thank you for your contribution.
I came across a script to generate a skeleton app for Erlang + Thrift. I'm fairly new to erlang and Thrift so I'm not sure how thet play together.
http://github.com/toddlipcon/thrift_erl_skel/tree/master
Post a Comment