Biggest differences of Thrift vs Protocol Buffers?

前端 未结 15 1603
無奈伤痛
無奈伤痛 2020-11-30 15:59

What are the biggest pros and cons of Apache Thrift vs Google\'s Protocol Buffers?

相关标签:
15条回答
  • 2020-11-30 16:22

    It's also important to note that not all supported languages compair consistently with thrift or protobuf. At this point it's a matter of the modules implementation in addition to the underlying serialization. Take care to check benchmarks for whatever language you plan to use.

    0 讨论(0)
  • 2020-11-30 16:25

    One obvious thing not yet mentioned is that can be both a pro or con (and is same for both) is that they are binary protocols. This allows for more compact representation and possibly more performance (pros), but with reduced readability (or rather, debuggability), a con.

    Also, both have bit less tool support than standard formats like xml (and maybe even json).

    (EDIT) Here's an Interesting comparison that tackles both size & performance differences, and includes numbers for some other formats (xml, json) as well.

    0 讨论(0)
  • 2020-11-30 16:26

    As I've said as "Thrift vs Protocol buffers" topic :

    Referring to Thrift vs Protobuf vs JSON comparison :

    • Thrift supports out of the box AS3, C++, C#, D, Delphi, Go, Graphviz, Haxe, Haskell, Java, Javascript, Node.js, OCaml, Smalltalk, Typescript, Perl, PHP, Python, Ruby, ...
    • C++, Python, Java - in-box support in Protobuf
    • Protobuf support for other languages (including Lua, Matlab, Ruby, Perl, R, Php, OCaml, Mercury, Erlang, Go, D, Lisp) is available as Third Party Addons (btw. Here is SWI-Prolog support).
    • Protobuf has much better documentation and plenty of examples.
    • Thrift comes with a good tutorial
    • Protobuf objects are smaller
    • Protobuf is faster when using "optimize_for = SPEED" configuration
    • Thrift has integrated RPC implementation, while for Protobuf RPC solutions are separated, but available (like Zeroc ICE ).
    • Protobuf is released under BSD-style license
    • Thrift is released under Apache 2 license

    Additionally, there are plenty of interesting additional tools available for those solutions, which might decide. Here are examples for Protobuf: Protobuf-wireshark , protobufeditor.

    0 讨论(0)
  • 2020-11-30 16:27

    RPC is another key difference. Thrift generates code to implement RPC clients and servers wheres Protocol Buffers seems mostly designed as a data-interchange format alone.

    0 讨论(0)
  • 2020-11-30 16:29

    I think the basic data structure is different

    1. Protocol Buffer use variable-length integee which refers to variable-length digital encoding, turning a fixed-length number into a variable-length number to save space.
    2. Thrift proposed different types of serialization formats (called "protocols"). In fact, Thrift has two different JSON encodings, and no less than three different binary encoding methods.

    In conclusion,these two libraries are completely different. Thrift likes a one-stop shop, giving you the entire integrated RPC framework and many options (supporting cross-language), while Protocol Buffers is more inclined to "just do one thing and do it well".

    0 讨论(0)
  • 2020-11-30 16:31

    They both offer many of the same features; however, there are some differences:

    • Thrift supports 'exceptions'
    • Protocol Buffers have much better documentation/examples
    • Thrift has a builtin Set type
    • Protocol Buffers allow "extensions" - you can extend an external proto to add extra fields, while still allowing external code to operate on the values. There is no way to do this in Thrift
    • I find Protocol Buffers much easier to read

    Basically, they are fairly equivalent (with Protocol Buffers slightly more efficient from what I have read).

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