Rabu, 11 Juli 2018

Sponsored Links

An introduction to Apache Thrift - YouTube
src: i.ytimg.com

Save is the interface definition language and binary communication protocol used to define and create services for multiple languages. It forms a remote procedure framework (RPC) and is developed on Facebook for "scalable cross-language service development". It combines software stacks with code-makers to build cross-platform services that can connect applications written in multiple languages ​​and frameworks, including ActionScript, C, C, C #, Cappuccino, Cocoa, Delphi, Erlang, Go, Haskell, Java , Node.js, Objective-C, OCaml, Perl, PHP, Python, Ruby, and Smalltalk. Although developed on Facebook, it is now an open source project in the Apache Software Foundation. The implementation was described in a April 2007 technical paper released by Facebook, now hosted on Apache.


Video Apache Thrift



Architecture

Thrifty includes full stacks to create clients and servers. The upper part is the code generated from the Thrift definition. From this file, the service generates client code and processor. Unlike the built-in type, the data structure created is sent as a result of the generated code. The protocol and transport layer are part of the runtime library. With savings, it is possible to specify services and change protocols and transport without recompiling the code. In addition to client sections, Thrift includes a server infrastructure to connect protocols and transport together, such as blocking, non-blocking, and multi-threaded servers. The underlying I/O parts of the stack are applied differently to different languages.

Save supports a number of protocols:

  • TBinaryProtocol - Direct, simple, but not optimized binary format for space efficiency. Faster to process than text protocol but more difficult to debug.
  • TCompactProtocol - A simpler binary format; usually more efficient for processing as well
  • TDebugProtocol - A human readable text format to aid in debugging.
  • TDenseProtocol - Similar to TCompactProtocol, removes the meta information from what is being transmitted.
  • TJSONProtocol - Uses JSON to encrypt data.
  • TSimpleJSONProtocol - A write-only protocol that can not be parsed by Thrift because it drops metadata using JSON. Suitable for outlining with scripting languages.

Supported ships are:

  • TFileTransport - This transport writes to a file.
  • TFramedTransport - This transport is required when using a non-blocking server. It sends data in a frame, where each frame is preceded by long information.
  • TMemoryTransport - Uses memory for I/O. The Java implementation uses a simple ByteArrayOutputStream internally.
  • TSocket - Uses I/O sockets for transport.
  • TZlibTransport - Compresses using zlib. Used in conjunction with other transportation.

Thrifty also provides a number of servers, which

  • TNonblockingServer - A multi-threaded server using non-blocking I/O (Java implementations using NIO channels). TFramedTransport must be used with this server.
  • TSimpleServer - The single-threaded server uses standard block I/O. Useful for testing.
  • TThreadPoolServer - Multi-threaded server using standard I/O blocking.

Maps Apache Thrift



Benefits

Some of the benefits expressed from Thrift include:

  • Cross-language submissions with lower overhead than alternatives like SOAP due to the use of binary formats
  • The library is lean and clean. There is no framework for code. There is no XML configuration file.
  • Language bindings are natural. For example, Java uses ArrayList & lt; String & gt; . C using std :: vector & lt; std :: string & gt; .
  • Wire-level application formats and wire-level serialization wire formats neatly. They can be modified separately.
  • The predefined serialization style includes: binary, HTTP friendly, and compact binary.
  • Double as cross-language file serialization.
  • Soft version of the protocol. Efficient does not require centralized and explicit mechanisms such as major/minor versions. Loosely coupled teams can freely develop RPC calls.
  • Do not build dependencies or non-standard software. There is no mix of incompatible software licenses.

Thrift + Graphs = Strong, flexible schemas on Hadoop - thoughts ...
src: s3.media.squarespace.com


Create a Save service

Thrives written in C, but can generate code for a number of languages. To create a Thrift service, one must write a Thrift file that describes it, generate code in the destination language, write some code to start the server, and call it from the client. Here is a sample code from the description file:

Excess will generate code from this descriptive information. For example, in Java, PhoneType would be simple in the Phone class.

Working with Apache HBASE Thrift - Chapter 12 - YouTube
src: i.ytimg.com


See also

  • Comparison of data serialization formats
  • Apache Avro
  • Abstract Syntax Notation One
  • Hessian (Web service protocol)
  • Protocol Buffer
  • External Data Representation
  • Internet Communications Machine
  • SDXF
  • GraalVM

Rethinking CodeGen: IDL, Thrift, gRPC, Ohh My
src: res.infoq.com


References


JSON RPC vs SOAP vs Apache Thrift What to Use and What Makes them ...
src: i.ytimg.com


External links

  • Official website


Source of the article : Wikipedia

Comments
0 Comments