Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is RPC framework and Apache Thrift?

Tags:

rpc

thrift

I need to learn Apache Thrift for a University project. As this tutorial says, it is an RPC framework, and it was the only document I could find for Thrift other than their documentation.

Can someone tell me what is a RPC framework and how does this relate to Apache Thrift?

like image 723
bula Avatar asked Dec 18 '13 08:12

bula


People also ask

Is Apache Thrift an RPC?

Apache Thrift allows you to define data types and service interfaces in a simple definition file. Taking that file as input, the compiler generates code to be used to easily build RPC clients and servers that communicate seamlessly across programming languages.

What are RPC frameworks?

An RPC framework in general is a set of tools that enable the programmer to call a piece of code in a remote process, be it on a different machine or just another process on the same machine.

What is Thrift RPC server?

Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC. Thrift provides clean abstractions for data transport, data serialization, and application level processing. Thrift was originally developed by Facebook and now it is open sourced as an Apache project.

What is Thrift used for?

Thrift uses a special Interface Description Language (IDL) to define data types and service interfaces which are stored as . thrift files and used later as input by the compiler for generating the source code of client and server software that communicate over different programming languages.


1 Answers

An RPC framework in general is a set of tools that enable the programmer to call a piece of code in a remote process, be it on a different machine or just another process on the same machine.

In the particular case of Apache Thrift, we talk about a framework designed to be efficient, and available across both OS platforms and programming languages. Additionally, you have some flexibility regarding transports (such as sockets, pipes, etc) and protocols (binary, JSON, even compressed), plus some more options like SSL or SASL support.

For example, you may set up a server on a Linux machine, written in C++ which offers some service to the world through a JSON-based protocol over HTTP. This service may be called by a client program written in Python, running on a Windows machine. The code for both server and client is generated from a Thrift IDL file. To get it running, you basically have to add only the intended program logic and put all the pieces together.

The single best reference for Apache Thrift is still the Apache Thrift Whitepaper. Although slightly outdated in some of the details, the underling concepts are still valid. Another good read is Diwaker Gupta's "Missing Guide", and last not least the forthcoming book from Randy Abernethy.

For beginners, I would recommend to start with the Apache Thrift tutorial suite, these examples show a lot of the core features. If you run into questions, you are welcome to ask here on SO, or on the Thrift mailing lists.

like image 115
JensG Avatar answered Oct 13 '22 01:10

JensG