Thrift vs Protocol buffers [duplicate]

2019-01-21 00:02发布

This question already has an answer here:

I've been using PB for quite a while now, but, Thrift has constantly been at the back of my mind.

The primary advantages of thrift, as I see it are:

  1. Native collections (i.e, vector, set etc) vs PBs repeated providing functionality similar to, but not quite like (no iterators unless you dig into RepeatedField which the documentation states "shouldn't be required in most cases").
  2. A decent RPC implementation provided, instead of just hooks to plug your own in.
  3. More officially supported languages (PB offers "official" support for Java, C++, Python)

The cons of Thrift:

  1. The RPC implementation means I can't plug in my own (for example) encryption/authentication layer on top.
  2. Windows support doesn't seem to be great.
  3. PB definitely seems to have, if not better, more accessible documentation.

Neutral:

  • Unknown size of .lib/.dll on Windows (Thrift).
  • Large size of .lib on Windows (PB, but it does offer a -lite which is significantly smaller).
  • Speed wise, they both seem to be similar.

I'm not quite ready to take the plunge and switch to Thrift yet, can anyone offer me more pros/cons, or reasons to go one way or the other?

Thanks!

4条回答
放我归山
2楼-- · 2019-01-21 00:25

Our project's main reason to stick with Thrift over protocol buffers was that protocol buffers don't auto-generate a complete RPC server, and existing solutions for PB seemed to all be fairly unstable. Just my $0.02.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-21 00:30

As I've said as "Biggest differences of Thrift vs Protocol Buffers?" topic :

Referring to Thrift vs Protobuf vs JSON comparison :

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

查看更多
看我几分像从前
4楼-- · 2019-01-21 00:30

You might want to analyse your need first:

Do you need a protocol-agnostic format? For example, do you want to implement a custom protocol or need 100% portability? In such a case use PB.

If you are fine with the default protocol of Thrift, and you need a protocol to begin with, by all means, go with Thrift.

Hope this helps.

查看更多
一夜七次
5楼-- · 2019-01-21 00:44

You need to specify your use case(s) in detail. Else this is a "Which is better, a car or a truck?" question.

查看更多
登录 后发表回答