Apache Thrift

Last updated

Apache Thrift
Original author(s) Facebook, Inc.
Developer(s) Apache Software Foundation
Stable release
0.21.0 / 9 September 2024;18 days ago (2024-09-09) [1]
Repository Thrift repository
Written in ActionScript, C, C#, C++, D, Dart, Delphi, Erlang, Go, Haskell, Haxe, Java, JavaScript, Node.js, OCaml, Perl, PHP, Python, Rust, Scala, Smalltalk
Type Remote procedure call framework
License Apache 2.0
Website thrift.apache.org

Thrift is an IDL (Interface Definition Language) and binary communication protocol [2] used for defining and creating services for programming languages. [3] It was developed by Facebook. Since 2020, it is an open source project in the Apache Software Foundation.

Contents

It uses a remote procedure call (RPC) framework and combines a software stack with a code generation engine to build cross-platform services. Thrift can connect applications written in a variety of languages and frameworks, including ActionScript, C, C++, [4] C#, [5] Cocoa, Delphi, Erlang, Go, Haskell, Java, JavaScript, Objective-C, OCaml, Perl, PHP, Python, Ruby, Elixir, Rust, Scala, Smalltalk, and Swift. [6] The implementation was described in an April 2007 technical paper released by Facebook, now hosted on Apache. [7] [8]

Architecture

The Apache Thrift API client/server architecture Apache Thrift architecture.png
The Apache Thrift API client/server architecture

Thrift includes a complete stack for creating clients and servers. [9] The top part is generated code from the Thrift definition. From this file, the services generate client and processor codes. In contrast to built-in types, created data structures are sent as a result of generated code. The protocol and transport layer are part of the runtime library. With Thrift, it is possible to define a service and change the protocol and transport without recompiling the code. Besides the client part, Thrift includes server infrastructure such as blocking, non-blocking, and multi-threaded servers. The underlying I/O part of the stack is implemented differently for different programming languages. [9]

Thrift supports a number of protocols: [9]

The supported transports are:

Thrift also provides a number of servers, which are:

Thrift is written in C++, but can create code for some other programming languages. To create a Thrift service, one has to write Thrift files that describe it, generate the code in the destination language, write some code to start the server, and call it from the client. An example of such a description file:

enumPhoneType{HOME,WORK,MOBILE,OTHER}structPhone{1:i32id,2:stringnumber,3:PhoneTypetype}servicePhoneService{PhonefindById(1:i32id),list<Phone>findAll()}

Thrift will generate the code out of this descriptive information. For instance, in Java, the PhoneType will be enum inside the Phone class.

See also

Related Research Articles

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space, which is written as if it were a normal (local) procedure call, without the programmer explicitly writing the details for the remote interaction. That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. This is a form of client–server interaction, typically implemented via a request–response message passing system. In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI). The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls. Remote calls are usually orders of magnitude slower and less reliable than local calls, so distinguishing them is important.

<span class="mw-page-title-main">Web server</span> Computer software that distributes web pages

A web server is computer software and underlying hardware that accepts requests via HTTP or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiates communication by making a request for a web page or other resource using HTTP, and the server responds with the content of that resource or an error message. A web server can also accept and store resources sent from the user agent if configured to do so.

The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between systems on different operating systems, programming languages, and computing hardware. CORBA uses an object-oriented model although the systems that use the CORBA do not have to be object-oriented. CORBA is an example of the distributed object paradigm.

<span class="mw-page-title-main">Interface description language</span> Computer language used to describe a software components interface

An interface description language or interface definition language (IDL) is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs are usually used to describe data types and interfaces in a language-independent way, for example, between those written in C++ and those written in Java.

<span class="mw-page-title-main">WebObjects</span> Java web application server and framework originally developed by NeXT Software

WebObjects is a discontinued Java web application server and a server-based web application framework originally developed by NeXT Software, Inc.

OPeNDAP is an acronym for "Open-source Project for a Network Data Access Protocol," an endeavor focused on enhancing the retrieval of remote, structured data through a Web-based architecture and a discipline-neutral Data Access Protocol (DAP). Widely used, especially in Earth science, the protocol is layered on HTTP, and its current specification is DAP4, though the previous DAP2 version remains broadly used. Developed and advanced by the non-profit OPeNDAP, Inc., DAP is intended to enable remote, selective data-retrieval as an easily invoked Web service. OPeNDAP, Inc. also develops and maintains zero-cost (reference) implementations of the DAP protocol in both server-side and client-side software.

<span class="mw-page-title-main">JSON</span> Open standard file format and data interchange

JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays. It is a commonly used data format with diverse uses in electronic data interchange, including that of web applications with servers.

<span class="mw-page-title-main">Twisted (software)</span> Event-driven network programming framework

Twisted is an event-driven network programming framework written in Python and licensed under the MIT License.

<span class="mw-page-title-main">Apache Axis</span> Web service framework

Apache Axis is an open-source, XML based Web service framework. It consists of a Java and a C++ implementation of the SOAP server, and various utilities and APIs for generating and deploying Web service applications. Using Apache Axis, developers can create interoperable, distributed computing applications. Axis development takes place under the auspices of the Apache Software Foundation.

rdesktop

rdesktop is an implementation of a client software for Microsoft's proprietary Remote Desktop Protocol (RDP). Rdesktop is free and open-source software, subject to the requirements of the GNU General Public License (GPL-3.0-or-later), and is available for Linux and BSD as well as for Microsoft Windows.

The Apache JServ Protocol (AJP) is a binary protocol that can proxy inbound requests from a web server through to an application server that sits behind the web server. AJP is a highly trusted protocol and should never be exposed to untrusted clients, which could use it to gain access to sensitive information or execute code on the application server.

Apache Hadoop is a collection of open-source software utilities that facilitates using a network of many computers to solve problems involving massive amounts of data and computation. It provides a software framework for distributed storage and processing of big data using the MapReduce programming model. Hadoop was originally designed for computer clusters built from commodity hardware, which is still the common use. It has since also found use on clusters of higher-end hardware. All the modules in Hadoop are designed with a fundamental assumption that hardware failures are common occurrences and should be automatically handled by the framework.

OPC Unified Architecture is a cross-platform, open-source, IEC62541 standard for data exchange from sensors to cloud applications developed by the OPC Foundation. Distinguishing characteristics are:

Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines.

Web2py is an open-source web application framework written in the Python programming language. Web2py allows web developers to program dynamic web content using Python. Web2py is designed to help reduce tedious web development tasks, such as developing web forms from scratch, although a web developer may build a form from scratch if required.

<span class="mw-page-title-main">Apache Avro</span> Open-source remote procedure call framework

Avro is a row-oriented remote procedure call and data serialization framework developed within Apache's Hadoop project. It uses JSON for defining data types and protocols, and serializes data in a compact binary format. Its primary use is in Apache Hadoop, where it can provide both a serialization format for persistent data, and a wire format for communication between Hadoop nodes, and from client programs to the Hadoop services. Avro uses a schema to structure the data that is being encoded. It has two different types of schema languages: one for human editing and another which is more machine-readable based on JSON.

<span class="mw-page-title-main">Apache ActiveMQ</span> Software message broker

Apache ActiveMQ is an open source message broker written in Java together with a full Java Message Service (JMS) client. It provides "Enterprise Features" which in this case means fostering the communication from more than one client or server. Supported clients include Java via JMS 1.1 as well as several other "cross language" clients. The communication is managed with features such as computer clustering and ability to use any database as a JMS persistence provider besides virtual memory, cache, and journal persistency.

gRPC is a cross-platform high-performance remote procedure call (RPC) framework. gRPC was initially created by Google, but is open source and is used in many organizations. Use cases range from microservices to the "last mile" of computing. gRPC uses HTTP/2 for transport, Protocol Buffers as the interface description language, and provides features such as authentication, bidirectional streaming and flow control, blocking or nonblocking bindings, and cancellation and timeouts. It generates cross-platform client and server bindings for many languages. Most common usage scenarios include connecting services in a microservices style architecture, or connecting mobile device clients to backend services.

References

  1. "Apache Thrift - Downloads" . Retrieved September 27, 2024.
  2. "Installing and using Apache Cassandra With Java Part 4 (Thrift Client)". Sodeso – Software Development Solutions. Archived from the original on March 31, 2022. Retrieved March 30, 2011. Thrift is a separate Apache project which is a binary communication protocol
  3. Prunicki, Andrew. "Apache Thrift: Introduction". Object Computing. Archived from the original on July 23, 2011. Retrieved April 11, 2011. Using code generation, Thrift creates a set of files which can then be used for creating clients and/or servers.
  4. "ThriftRequirements". Apache Software Foundation. Archived from the original on February 26, 2024. Retrieved June 22, 2024.{{cite web}}: CS1 maint: unfit URL (link)
  5. Fred Potter, Using Thrift with Cappuccino Archived 2011-08-12 at the Wayback Machine , parallel48's posterously luscious blog, 10 June 2010.
  6. Andrew Prunicki. "Apache Thrift: Code Generation". Object Computing. Archived from the original on July 23, 2011. Retrieved April 12, 2011.
  7. Mark Slee, Aditya Agarwal, Marc Kwiatkowski, Thrift: Scalable Cross-Language Services Implementation
  8. "LibraryFeatures". Apache Software Foundation. July 11, 2019. Archived from the original on May 3, 2024. Retrieved April 21, 2016.
  9. 1 2 3 Andrew Prunicki. "Apache Thrift: Introduction". Object Computing. Archived from the original on July 23, 2011. Retrieved April 11, 2011.
  10. Skelton, Steven (August 3, 2013). "Developer Friendly Thrift Request Logging". stevenskelton.ca. Archived from the original on January 24, 2024. Retrieved July 3, 2014.