Difference between Apache Thrift and ZeroMQ

前端 未结 3 1188
甜味超标
甜味超标 2021-01-31 08:57

I understand that Apache Thrift and ZeroMQ are softwares belonging to different categories, and it is not easy to do a comparison since it is an apple to orange comparison. But

相关标签:
3条回答
  • 2021-01-31 09:29

    They belong to different categories primarily because they are targetted at different audiences with different concerns. Therefore they are better at different things.

    Apache Thrift similar to Google Protocol Buffers is intended to be high-level, reasonably well abstracted means to send data between processes on different machines, possibly in different languages. They purposefully provide an IDL-ish layer to describe the message, perhaps with automatic or semi-automatic versioning and optional sections.

    ZeroMQ specifically on the other hand, not message queues in general (which would be an entirely separate question), is all about speed. They efficiently move bytes to the other end. As few stops along the way as possible. As such, you are responsible for serialization, versioning, or whatever else is important to you the developer. Of course, this can mean complexity, particularly if you are communicating between different platforms and languages, but that's part of the penalty for lack of abstraction.

    Which to choose? Depends on your project. If you don't need absolute raw performance, a higher level toolkit will likely serve your purpose just fine. If you are building a high-speed low-latency application, you're going to end up closer to the metal anyways.

    Good Luck

    0 讨论(0)
  • 2021-01-31 09:36

    Thrift defines how to represent complex data so that it can be written and read by different languages (hence it has IDL to define types that will be transported). It also defines simple means to transport such formatted message between two end points (aka thirft transport).

    On the other hand ZeroMQ shines in ways you can transport message between endpoints in order to acquire different behaviors like one to one, one to many, many to many, and different expectations of speed and reliability of such transfers. And as for message itself it is just a blob to ZeroMQ, and apps should find a way to encode decode them.

    So if you have complex data structures but simple messaging patterns, you might lean on the thrift side. If you have simple data but complex messaging patterns, you might lean on the ZeroMQ or something like that (AMQP).

    And if you need both, you could use THrift and ZeroMQ in pair, thrift to format the message, and ZeroMQ to transport it.

    0 讨论(0)
  • 2021-01-31 09:47

    Davorin mentioned using Thrift and ZeroMQ in pair and in case you're interested in that approach checkout the Thrift codebase and look under thrift/contrib/zeromq for a demo of Thrift using ZermoMQ.

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