Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?

后端 未结 8 2067
一生所求
一生所求 2020-12-07 08:51

We\'re looking into transport/protocol solutions and were about to do various performance tests, so I thought I\'d check with the community if they\'ve already done this:

相关标签:
8条回答
  • 2020-12-07 09:16

    If the raw net performance is the target, then nothing beats IIOP (see RMI/IIOP). Smallest possible footprint -- only binary data, no markup at all. Serialization/deserialization is very fast too.

    Since it's IIOP (that is CORBA), almost all languages have bindings.

    But I presume the performance is not the only requirement, right?

    0 讨论(0)
  • 2020-12-07 09:20

    I did test performance of PB with number of other data formats (xml, json, default object serialization, hessian, one proprietary one) and libraries (jaxb, fast infoset, hand-written) for data binding task (both reading and writing), but thrift's format(s) was not included. Performance for formats with multiple converters (like xml) had very high variance, from very slow to pretty-darn-fast. Correlation between claims of authors and perceived performance was rather weak. Especially so for packages that made wildest claims.

    For what it is worth, I found PB performance to be bit over hyped (usually not by its authors, but others who only know who wrote it). With default settings it did not beat fastest textual xml alternative. With optimized mode (why is this not default?), it was bit faster, comparable with the fastest JSON package. Hessian was rather fast, textual json also. Properietary binary format (no name here, it was company internal) was the slowest. Java object serialization was fast for larger messages, less so for small objects (i.e. high fixed per-operation noverhead). With PB message size was compact, but given all trade-offs you have to do (data is not self-descriptive: if you lose the schema, you lose data; there are indexes of course, and value types, but from what you have reverse-engineer back to field names if you want), I personally would only choose it for specific use cases -- size-sensitive, closely coupled system where interface/format never (or very very rarely) changes.

    My opinion in this is that (a) implementation often matters more than specification (of data format), (b) end-to-end, differences between best-of-breed (for different formats) are usually not big enough to dictate the choice. That is, you may be better off choosing format+API/lib/framework you like using most (or has best tool support), find best implementation, and see if that works fast enough. If (and only if!) not, consider next best alternative.

    ps. Not sure what EJB3 here would be. Maybe just plain of Java serialization?

    0 讨论(0)
  • 2020-12-07 09:21

    I'm in the process of writing some code in an open source project named thrift-protobuf-compare comparing between protobuf and thrift. For now it covers few serialization aspects, but I intend to cover more. The results (for Thrift and Protobuf) are discussed in my blog, I'll add more when I'll get to it. You may look at the code to compare API, description language and generated code. I'll be happy to have contributions to achieve a more rounded comparison.

    0 讨论(0)
  • 2020-12-07 09:23

    Latest comparison available here at the thrift-protobuf-compare project wiki. It includes many other serialization libraries.

    0 讨论(0)
  • 2020-12-07 09:26

    To back up Vladimir's point about IIOP, here's an interesting performance test, that should give some additional info over the google benchmarks, since it compares Thrift and CORBA. (Performance_TIDorb_vs_Thrift_morfeo.pdf // link no longer valid) To quote from the study:

    • Thrift is very efficient with small data (basic types as operation arguments)
    • Thrifts transports are not so efficient as CORBA with medium and large data (struct and >complex types > 1 kilobytes).

    Another odd limitation, not having to do with performance, is that Thrift is limited to returning only several values as a struct - although this, like performance, can surely be improved perhaps.

    It is interesting that the Thrift IDL closely matches the CORBA IDL, nice. I haven't used Thrift, it looks interesting especially for smaller messages, and one of the design goals was for a less cumbersome install, so these are other advantages of Thrift. That said, CORBA has a bad rap, there are many excellent implementations out there like omniORB for example, which has bindings for Python, that are easy to install and use.

    Edited: The Thrift and CORBA link is no longer valid, but I did find another useful paper from CERN. They evaluated replacements for their CORBA system, and, while they evaluated Thrift, they eventually went with ZeroMQ. While Thrift performed the fastest in their performance tests, at 9000 msg/sec vs. 8000 (ZeroMQ) and 7000+ RDA (CORBA-based), they chose not to test Thrift further because of other issues notably:

    It is still an immature product with a buggy implementation

    0 讨论(0)
  • 2020-12-07 09:30

    You may be interested in this question: "Biggest differences of Thrift vs Protocol Buffers?"

    0 讨论(0)
提交回复
热议问题