Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Apache Thrift

From Wikipedia, the free encyclopedia
Open-source remote procedure call framework
This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages)
This articlecontainspromotional content. Please helpimprove it by removingpromotional language and inappropriateexternal links, and by adding encyclopedic text written from aneutral point of view.
See ouradvice if the article is about you and read ourscam warning in case someone asks for money to edit this article.
(August 2019) (Learn how and when to remove this message)
This articlecontainsinstructions or advice. Wikipedia is not a guidebook; please helprewrite such content to be encyclopedic or move it toWikiversity,Wikibooks, orWikivoyage.(August 2019)
(Learn how and when to remove this message)
Apache Thrift
Original authorFacebook, Inc.
DeveloperApache Software Foundation
Stable release
0.21.0 / 9 September 2024; 17 months ago (2024-09-09)[1]
Written inActionScript,C,C#,C++,D,Dart,Delphi,Erlang,Go,Haskell,Haxe,Java,JavaScript,Node.js,OCaml,Perl,PHP,Python,Rust,Scala,Smalltalk
TypeRemote procedure call framework
LicenseApache 2.0
Websitethrift.apache.org
RepositoryThrift repository

Thrift is an IDL (Interface Definition Language) andbinary communication protocol[2] used for defining and creatingservices forprogramming languages.[3] It was developed byFacebook. Since 2020, it is anopen source project in theApache Software Foundation.

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

Architecture

[edit]
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, createddata structures are sent as a result of generated code. The protocol andtransport layer are part of theruntime 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, andmulti-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]

  • TBinaryProtocol – A binary format not optimized forspace efficiency. Faster to process than the text protocol.
  • TCompactProtocol – More compact binary format.
  • TJSONProtocol – UsesJSON for the encoding of data.
  • TSimpleJSONProtocol – A write-only protocol that cannot be parsed by Thrift because it drops metadata using JSON. Suitable for parsing by scripting languages.[10]

The supportedtransports are:

  • TSimpleFileTransport – This transport writes to a file.
  • TFramedTransport – This transport is required when using a non-blocking server. It sends data in frames, each preceded by length information.
  • TMemoryTransport – Usesmemory for I/O. The Java implementation uses a simpleByteArrayOutputStream internally.
  • TSocket – Uses blocking socket I/O for transport.
  • TZlibTransport – Performs compression usingzlib. Used in conjunction with another transport.

Thrift also provides a number of servers, which are:

  • TNonblockingServer – A multi-threaded server usingnon-blocking I/O (Java implementation usesNIO channels). TFramedTransport must be used with this server.
  • TSimpleServer – A single-threaded server using standard blocking I/O.
  • TThreadedServer – A multi-threaded server using a thread per connection model and standard blocking I/O.
  • TThreadPoolServer – A multi-threaded server using a thread pool and standard blocking I/O.

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, thePhoneType will beenum inside thePhone class.

See also

[edit]

References

[edit]
  1. ^"Apache Thrift - Downloads". RetrievedSeptember 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. RetrievedMarch 30, 2011.Thrift is a separate Apache project which is a binary communication protocol
  3. ^Prunicki, Andrew."Apache Thrift: Introduction".Object Computing. Archived fromthe original on July 23, 2011. RetrievedApril 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. RetrievedJune 22, 2024.
  5. ^Fred Potter,Using Thrift with CappuccinoArchived 2011-08-12 at theWayback Machine, parallel48's posterously luscious blog, 10 June 2010.
  6. ^Andrew Prunicki."Apache Thrift: Code Generation".Object Computing. Archived fromthe original on July 23, 2011. RetrievedApril 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, 2023. RetrievedApril 21, 2016.
  9. ^abcAndrew Prunicki."Apache Thrift: Introduction".Object Computing. Archived fromthe original on July 23, 2011. RetrievedApril 11, 2011.
  10. ^Skelton, Steven (August 3, 2013)."Developer Friendly Thrift Request Logging".stevenskelton.ca.Archived from the original on January 24, 2024. RetrievedJuly 3, 2014.

External links

[edit]
Top-level
projects
Commons
Incubator
Other projects
Attic
Licenses
Human
readable
Binary
Products,
services
Facebook
Instagram
Hardware
Other
Former
People
Founders
Board
Current
Former
Executive
officers
Current
Former
Oversight
Board
Members
Board of
Trustees
Former
members
Notable
employees
Current
Former
Open
source
Mass
media
Concepts
Business
Lists
Related
Retrieved from "https://en.wikipedia.org/w/index.php?title=Apache_Thrift&oldid=1278359350"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp