Comparison of cross-language communication frameworks--PROTOBUF, thrift and Avro

Source: Internet
Author: User

I. Overview

Thrift : Is by Facebook Leading development of a cross-platform, multi-language support, by defining IDL file, a tool that automatically generates RPC client and server-side communication code to build in C + +, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C #, Cocoa, JavaScript, node. js, Smalltalk, and OCaml are seamlessly integrated and efficient services among these programming languages. Thrift defines the interface and data type of RPC through an intermediate language (IDL, Interface Definition language), then generates code in different languages through a compiler and is responsible for the implementation of RPC protocol layer and transport layer by the generated code.

Protocol Buffer is a kind of mechanism of serialized and structured data, which has the features of cross-platform, fast parsing speed, small volume of serialized data, high expansibility and simple use.

Apache Avro is a binary data serialization system. In fact , Avro provides remote call ( RPC ) functionality In addition to serialization, like MP . Avro is a sub-project belonging to Hadoop, by the founder of Hadoop Doug Cutting led the development, designed to support large-scale data exchange applications, dependency patterns (schemas) to implement data structure definitions, patterns from JSON object to represent, Avro also be used as a RPC framework to use. When the client wants to interact with the server side, it needs to exchange the protocol for both sides of the communication, which is similar to the pattern, needs to be defined by both parties, and is called a message in Avro . Both sides of the communication must maintain this agreement in order to parse the data sent from each other, which is the legendary handshake phase.

Second, contrast

Compared with three kinds of frameworks, it should be thrift, because it not only has the processing of protocol encapsulation and parsing, but also has a complete communication framework, completely encapsulates the underlying communication, and for the user, as long as the framework of the client and server interface callback, the processing logic can be.

Comprehensive comparison

Protobuf Thrift
features is primarily a serialization mechanism
support language c++/java/python c++, Java, Python, Ruby, Perl, PHP, C #, Erlang, Haskell
Ease of use syntax similar, usage, etc. similar to
The quality of the generated code Readability is passable, execution efficiency is measured by another
version compatibility at upgrade All support backward and forward compatible
learning cost single function (not suitable for complex applications), easy to learn feature rich, high learning cost
Documentation & Community Official documents Richer, Google search protocol buffer has 2000w+ results, Google Group is not accessible by the wall Fewer official documents, no API documentation, Google search Apache thrift only 40W results, mailing list not active

Performance comparison
Because the thrift function is richer than PROTOBUF, the performance comparison is performed on a single serialization mechanism, according to the number of bytes after serialization, serialization time, deserialization time three indicators, the thrift binary, compression, Protobuf in three different formats: Protobuf has fewer bytes after serialization and has a shorter serialization and deserialization time.

Comparison of cross-language communication frameworks--PROTOBUF, thrift and Avro

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.