SlideShare a Scribd company logo
-- Randy Abernethy, rx-m llc, 2014
polyglotism
• Modern distributed applications are rarely composed of
modules written in a single language
• Weaving together innovations made in a range of languages
is a core competency of successful enterprises
• Cross language communications are a necessity, not a luxury
thrift • Apache Thrift
– A high performance, scalable cross language serialization and RPC framework
• What?
– Full RPC Implementation - Apache Thrift supplies a complete RPC solution:
clients, servers, everything but your business logic
– Modularity - Apache Thrift supports plug-in serialization protocols:
binary, compact, json, or build your own
– Multiple End Points – Plug-in transports for network, disk and memory end points,
making Thrift easy to integrate with other communications and storage solutions like
AMQP messaging and HDFS
– Performance - Apache Thrift is fast and efficient, solutions for minimal parsing
overhead and minimal size
– Reach - Apache Thrift supports a wide range of languages and platforms:
Linux, OSX, Windows, Embedded Systems, Mobile, Browser, C++, Go, PHP, Erlang,
Haskell, Ruby, Node.js, C#, Java, C, OCaml, ObjectiveC, D, Perl, Python, SmallTalk, …
– Flexibility - Apache Thrift supports interface evolution, that is to say, CI/CD
environments can roll new interface features incrementally without breaking existing
infrastructure
• Service
Interfaces
are described
with the
Apache Thrift
Interface
Definition
Language
(IDL)
• Client/Server
Stubs
are generated
with the
Apache Thrift
IDL Compiler
• The IDL Compiler can generate stubs in over 15 languages
• Existing code modules are easily converted into RPC services
using the Apache Thrift Server Library
rpcservices
performance
&reach
• Thrift provides excellent performance for
all but the most demanding solutions
• Thrift provides broad reach, supporting a
wide range of languages and platforms
Custom Thrift REST
Extreme
Performance
Extreme
Reach
High Performance
Broad Reach
Enterprise
Compact
Frameworks, C, etc.
Web tech,
scripting
SOA, RPC Servers,
Java, C#, C++, etc.
WebEmbedded
thriftidl
1. Define the service interface in IDL
2. Compile the IDL to generate client/server stubs
3. Connect the server stubs to the desired implementation
4. Choose an Apache Thrift server to host your service
5. Call RPC functions like local function using the client stubs
#sail_stats.thrift
service SailStats {
double GetSailorRating(1: string SailorName)
double GetTeamRating(1: string TeamName)
double GetBoatRating(1: i64 BoatSerialNumber)
list<string> GetSailorsOnTeam(1: string TeamName)
list<string> GetSailorsRatedBetween(1: double MinRating,
2: double MaxRating)
string GetTeamCaptain(1: string TeamName)
}
helloworld
~/thrift/hello $ ls -l
-rw-r--r-- 1 dev dev 95 Mar 26 16:28 hello.thrift
~/thrift/hello $ thrift -gen py hello.thrift
~/thrift/hello $ ls -l
drwxr-xr-x 3 dev dev 4096 Mar 26 16:31 gen-py
-rw-r--r-- 1 dev dev 95 Mar 26 16:28 hello.thrift
~/thrift/hello $ ls -l gen-py
drwxr-xr-x 2 dev dev 4096 Mar 26 16:31 hello
-rw-r--r-- 1 dev dev 0 Mar 26 16:31 __init__.py
~/thrift/hello $ ls -l gen-py/hello
-rw-r--r-- 1 dev dev 248 Mar 26 16:31 constants.py
-rw-r--r-- 1 dev dev 5707 Mar 26 16:31 HelloSvc.py
-rwxr-xr-x 1 dev dev 1896 Mar 26 16:31 HelloSvc-remote
-rw-r--r-- 1 dev dev 46 Mar 26 16:31 __init__.py
-rw-r--r-- 1 dev dev 398 Mar 26 16:31 ttypes.py
~/thrift/hello $
• Compiling IDL for an
RPC service
Generated Code
• Interface Constants
• HelloSvc Stubs
• Sample Client
• Package Init File
• Interface Types
helloserver • A Python RPC Server
helloclient • A Python RPC Client
compiled
languages
• A C++ RPC client
#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
#include <thrift/transport/TSocket.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include "gen-cpp/HelloSvc.h""
using namespace apache::thrift::transport;
using namespace apache::thrift::protocol;
using namespace boost;
int main() {
auto socket = make_shared<TSocket>("localhost", 8585);
socket->open();
auto protocol = make_shared<TBinaryProtocol>(socket);
HelloSvcClient client(protocol);
std::string msg;
client.hello_func(msg);
std::cout << "[Client] received: " << msg << std::endl;
}
jvmlanguages • A Java RPC client
operational
.netlanguages • A C# RPC client
• Apache Thrift uses a compiled IDL implementation
– IDL is compiled generating stubs used at run time
– Runtime serialization code allows for interface evolution
• Apache Thrift IDL supports
– Service Interface Definition
– Type Definition
• Service interfaces are exposed by Servers
– Servers can implement many service interfaces
– Interfaces can inherit from other interfaces
• Types define serialization schemas
– Types can be serialized to memory, disk or networks
– Collections are supported (map, list, set)
– Structures and Unions support composite types
– DAGs are supported
• New addition not widely implemented as of yet
morethanrpc
Interface Evolution
Apache Thrift allows
fields and parameters to
be added and removed
incrementally without
breaking pre-existing
code, allowing systems to
grow incrementally over
time (just like businesses)
Particularly effective
in dynamic CI/CD
environments
abstractand
isolated
• Crafting an effective IDL requires understanding
some of the most important things about your
system
– What are the key entities in your system and how are they
described
– What are their cardinalities
– What are their keys
– Which are immutable
– Can you define idempotent interfaces for mutations
– What are the operational affinity groups in your system
– What is your system model and how will state and services
be distributed across it
• All of these things bear directly on IDL design
• Free of implementation, you can get the concepts
right and then choose the best languages and tools
to implement them
entities&idl
• Modern IDLs, like
Apache Thrift, provide
a rich set of tools for
describing system
entities (aka. messages)
• Capturing and codifying
the key system entities
is prerequisite to
effective interface
specification
• In some settings
crafting the entities
(e.g. an order) is all that
the IDL need do
Services
are
Optional!
commschemes
• Streaming – Communications
characterized by an ongoing flow of
bytes from a server to one or more
clients.
– Example: An internet radio broadcast
where the client receives bytes over time
transmitted by the server in an ongoing
sequence of small packets.
• Messaging – Message passing
involves one way asynchronous, often
queued, communications, producing
loosely coupled systems.
– Example: Sending an email message
where you may get a response or you
may not, and if you do get a response you
don’t know exactly when you will get it.
• RPC – Remote Procedure Call systems
allow function calls to be made
between processes on different
computers.
– Example: An iPhone app calling a service
on the Internet which returns the
weather forecast.
Apache Thrift is an efficient cross platform
serialization solution for streaming interfaces
Apache Thrift provides a complete RPC framework
architecture
• User Code
– client code calls RPC
methods and/or
[de]serializes objects
– service handlers
implement RPC service
behavior
• Generated Code
– RPC stubs supply client
side proxies and server
side processors
– type serialization code
provides serialization for
IDL defined types
• Library Code
– servers host user
defined services,
managing connections
and concurrency
– protocols perform
serialization
– transports move bytes
from here to there
• The Thrift framework was originally developed at Facebook and
released as open source in 2007. The project became an Apache
Software Foundation incubator project in 2008, after which four
early versions were released.
• 0.2.0 released 2009-12-12
• 0.3.0 released 2010-08-05
• 0.4.0 released 2010-08-23
• 0.5.0 released 2010-10-07
• In 2010 the project was moved to Apache top level status where
several additional versions have been released.
• 0.6.0 released 2011-02-08
• 0.6.1 released 2011-04-25
• 0.7.0 released 2011-08-13
• 0.8.0 released 2011-11-29
• 0.9.0 released 2012-10-15
• 0.9.1 released 2013-07-16
• 0.9.2 released 2014-06-01
• 1.0.0 released 2015-01-01
versions
it is difficult to make
predictions, particularly
about the future.
-- Mark Twain, Yogi Berra,
etc.
Open Source
Community Developed
Apache License Version 2.0
resources
• Web
– thrift.apache.org
– github.com/apache/thrift
• Mail
– Users: user-subscribe@thrift.apache.org
– Developers: dev-subscribe@thrift.apache.org
• Chat
– #thrift
• Book
– Abernethy (2014), The Programmer’s Guide to
Apache Thrift, Manning Publications Co.
[http://www.manning.com/abernethy/]
Chapter
1 is free
Randy Abernethy
ra@apache.org

More Related Content

What's hot

Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
Impetus Technologies
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Igor Anishchenko
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Chicago Hadoop Users Group
 
Optimizing LAMPhp Applications
Optimizing LAMPhp ApplicationsOptimizing LAMPhp Applications
Optimizing LAMPhp Applications
Piyush Goel
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
IndicThreads
 
Thrift
ThriftThrift
Thrift
银行 孙
 
Redis Lua Scripts
Redis Lua ScriptsRedis Lua Scripts
Redis Lua Scripts
Itamar Haber
 
Build Your Own Tools
Build Your Own ToolsBuild Your Own Tools
Build Your Own Tools
Shugo Maeda
 
Data Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol BuffersData Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol Buffers
William Kibira
 
Servlet basics
Servlet basicsServlet basics
Servlet basics
Santosh Dhoundiyal
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
Sleepy Head
 
Reversing Google Protobuf protocol
Reversing Google Protobuf protocolReversing Google Protobuf protocol
Reversing Google Protobuf protocol
n|u - The Open Security Community
 
jkljklj
jkljkljjkljklj
jkljklj
hoefo
 
Apache Avro and Messaging at Scale in LivePerson
Apache Avro and Messaging at Scale in LivePersonApache Avro and Messaging at Scale in LivePerson
Apache Avro and Messaging at Scale in LivePerson
LivePerson
 
REST Servers in Delphi XE Using DataSnap
REST Servers in Delphi XE Using DataSnapREST Servers in Delphi XE Using DataSnap
REST Servers in Delphi XE Using DataSnap
Embarcadero Technologies
 
Server Side Technologies
Server Side TechnologiesServer Side Technologies
Server Side Technologies
tawi123
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Cloudera, Inc.
 

What's hot (20)

Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
Multiplexing in Thrift: Enhancing thrift to meet Enterprise expectations- Imp...
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
 
3 apache-avro
3 apache-avro3 apache-avro
3 apache-avro
 
Optimizing LAMPhp Applications
Optimizing LAMPhp ApplicationsOptimizing LAMPhp Applications
Optimizing LAMPhp Applications
 
Rest style web services (google protocol buffers) prasad nirantar
Rest style web services (google protocol buffers)   prasad nirantarRest style web services (google protocol buffers)   prasad nirantar
Rest style web services (google protocol buffers) prasad nirantar
 
Protocol Buffer.ppt
Protocol Buffer.pptProtocol Buffer.ppt
Protocol Buffer.ppt
 
Thrift
ThriftThrift
Thrift
 
Redis Lua Scripts
Redis Lua ScriptsRedis Lua Scripts
Redis Lua Scripts
 
Build Your Own Tools
Build Your Own ToolsBuild Your Own Tools
Build Your Own Tools
 
Data Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol BuffersData Serialization Using Google Protocol Buffers
Data Serialization Using Google Protocol Buffers
 
Servlet basics
Servlet basicsServlet basics
Servlet basics
 
Fluentd and WebHDFS
Fluentd and WebHDFSFluentd and WebHDFS
Fluentd and WebHDFS
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
Reversing Google Protobuf protocol
Reversing Google Protobuf protocolReversing Google Protobuf protocol
Reversing Google Protobuf protocol
 
jkljklj
jkljkljjkljklj
jkljklj
 
Apache Avro and Messaging at Scale in LivePerson
Apache Avro and Messaging at Scale in LivePersonApache Avro and Messaging at Scale in LivePerson
Apache Avro and Messaging at Scale in LivePerson
 
REST Servers in Delphi XE Using DataSnap
REST Servers in Delphi XE Using DataSnapREST Servers in Delphi XE Using DataSnap
REST Servers in Delphi XE Using DataSnap
 
Server Side Technologies
Server Side TechnologiesServer Side Technologies
Server Side Technologies
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)
 

Viewers also liked

Facebook thrift
Facebook thriftFacebook thrift
Facebook thrift
Bhuvana Laksminarayanan
 
Mongo DB로 진행하는 CRUD
Mongo DB로 진행하는 CRUDMongo DB로 진행하는 CRUD
Mongo DB로 진행하는 CRUD
Jin wook
 
SKOS - 2007 Open Forum on Metadata Registries - NYC
SKOS - 2007 Open Forum on Metadata Registries - NYCSKOS - 2007 Open Forum on Metadata Registries - NYC
SKOS - 2007 Open Forum on Metadata Registries - NYC
jonphipps
 
Metadata and Terminology Registries
Metadata and Terminology RegistriesMetadata and Terminology Registries
Metadata and Terminology Registries
Marcia Zeng
 
Illustration of TextSecure's Protocol Buffer usage
Illustration of TextSecure's Protocol Buffer usageIllustration of TextSecure's Protocol Buffer usage
Illustration of TextSecure's Protocol Buffer usage
Christine Corbett Moran
 
Acceleration for big data, hadoop and memcached it168文库
Acceleration for big data, hadoop and memcached it168文库Acceleration for big data, hadoop and memcached it168文库
Acceleration for big data, hadoop and memcached it168文库Accenture
 
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
HBase Advanced Schema Design - Berlin Buzzwords - June 2012HBase Advanced Schema Design - Berlin Buzzwords - June 2012
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
larsgeorge
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
mysqlops
 
Metadata for Terminology / KOS Resources
Metadata for Terminology / KOS ResourcesMetadata for Terminology / KOS Resources
Metadata for Terminology / KOS Resources
Marcia Zeng
 
Hive User Meeting March 2010 - Hive Team
Hive User Meeting March 2010 - Hive TeamHive User Meeting March 2010 - Hive Team
Hive User Meeting March 2010 - Hive Team
Zheng Shao
 
Hive Object Model
Hive Object ModelHive Object Model
Hive Object Model
Zheng Shao
 
OVERVIEW OF FACEBOOK SCALABLE ARCHITECTURE.
OVERVIEW  OF FACEBOOK SCALABLE ARCHITECTURE.OVERVIEW  OF FACEBOOK SCALABLE ARCHITECTURE.
OVERVIEW OF FACEBOOK SCALABLE ARCHITECTURE.
Rishikese MR
 
아파치 쓰리프트 (Apache Thrift)
아파치 쓰리프트 (Apache Thrift) 아파치 쓰리프트 (Apache Thrift)
아파치 쓰리프트 (Apache Thrift)
Jin wook
 
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
Amazon Web Services
 
Data Science & Best Practices for Apache Spark on Amazon EMR
Data Science & Best Practices for Apache Spark on Amazon EMRData Science & Best Practices for Apache Spark on Amazon EMR
Data Science & Best Practices for Apache Spark on Amazon EMR
Amazon Web Services
 
Facebook architecture presentation: scalability challenge
Facebook architecture presentation: scalability challengeFacebook architecture presentation: scalability challenge
Facebook architecture presentation: scalability challenge
Cristina Munoz
 
Metadata is a Love Note to the Future
Metadata is a Love Note to the FutureMetadata is a Love Note to the Future
Metadata is a Love Note to the Future
Rachel Lovinger
 

Viewers also liked (18)

Facebook thrift
Facebook thriftFacebook thrift
Facebook thrift
 
Mongo DB로 진행하는 CRUD
Mongo DB로 진행하는 CRUDMongo DB로 진행하는 CRUD
Mongo DB로 진행하는 CRUD
 
SKOS - 2007 Open Forum on Metadata Registries - NYC
SKOS - 2007 Open Forum on Metadata Registries - NYCSKOS - 2007 Open Forum on Metadata Registries - NYC
SKOS - 2007 Open Forum on Metadata Registries - NYC
 
Metadata and Terminology Registries
Metadata and Terminology RegistriesMetadata and Terminology Registries
Metadata and Terminology Registries
 
Illustration of TextSecure's Protocol Buffer usage
Illustration of TextSecure's Protocol Buffer usageIllustration of TextSecure's Protocol Buffer usage
Illustration of TextSecure's Protocol Buffer usage
 
Acceleration for big data, hadoop and memcached it168文库
Acceleration for big data, hadoop and memcached it168文库Acceleration for big data, hadoop and memcached it168文库
Acceleration for big data, hadoop and memcached it168文库
 
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
HBase Advanced Schema Design - Berlin Buzzwords - June 2012HBase Advanced Schema Design - Berlin Buzzwords - June 2012
HBase Advanced Schema Design - Berlin Buzzwords - June 2012
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Metadata for Terminology / KOS Resources
Metadata for Terminology / KOS ResourcesMetadata for Terminology / KOS Resources
Metadata for Terminology / KOS Resources
 
Hive User Meeting March 2010 - Hive Team
Hive User Meeting March 2010 - Hive TeamHive User Meeting March 2010 - Hive Team
Hive User Meeting March 2010 - Hive Team
 
Hive Object Model
Hive Object ModelHive Object Model
Hive Object Model
 
OVERVIEW OF FACEBOOK SCALABLE ARCHITECTURE.
OVERVIEW  OF FACEBOOK SCALABLE ARCHITECTURE.OVERVIEW  OF FACEBOOK SCALABLE ARCHITECTURE.
OVERVIEW OF FACEBOOK SCALABLE ARCHITECTURE.
 
아파치 쓰리프트 (Apache Thrift)
아파치 쓰리프트 (Apache Thrift) 아파치 쓰리프트 (Apache Thrift)
아파치 쓰리프트 (Apache Thrift)
 
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
AWS re:Invent 2016: Deep Dive: Amazon EMR Best Practices & Design Patterns (B...
 
Data Science & Best Practices for Apache Spark on Amazon EMR
Data Science & Best Practices for Apache Spark on Amazon EMRData Science & Best Practices for Apache Spark on Amazon EMR
Data Science & Best Practices for Apache Spark on Amazon EMR
 
Facebook architecture presentation: scalability challenge
Facebook architecture presentation: scalability challengeFacebook architecture presentation: scalability challenge
Facebook architecture presentation: scalability challenge
 
Metadata is a Love Note to the Future
Metadata is a Love Note to the FutureMetadata is a Love Note to the Future
Metadata is a Love Note to the Future
 
Apache ppt
Apache pptApache ppt
Apache ppt
 

Similar to Apache Thrift, a brief introduction

2. RINA overview - TF workshop
2. RINA overview - TF workshop2. RINA overview - TF workshop
2. RINA overview - TF workshop
ARCFIRE ICT
 
Server training
Server trainingServer training
Server training
itassistantdahanu
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 
Basic of computers
Basic of computers Basic of computers
Basic of computers
Harsh Porwal
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
Ronny López
 
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
Spark Summit
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Timothy Spann
 
Music city data Hail Hydrate! from stream to lake
Music city data Hail Hydrate! from stream to lakeMusic city data Hail Hydrate! from stream to lake
Music city data Hail Hydrate! from stream to lake
Timothy Spann
 
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdfLEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
MahtabAhmedQureshi
 
Presentation 1
Presentation 1Presentation 1
Presentation 1aisadhsa
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
VMware Tanzu
 
Oracle Cloud - Infrastruktura jako kód
Oracle Cloud - Infrastruktura jako kódOracle Cloud - Infrastruktura jako kód
Oracle Cloud - Infrastruktura jako kód
MarketingArrowECS_CZ
 
FlowER Erlang Openflow Controller
FlowER Erlang Openflow ControllerFlowER Erlang Openflow Controller
FlowER Erlang Openflow ControllerHolger Winkelmann
 
Basic computers for DIU laptop project students
Basic computers for DIU laptop project studentsBasic computers for DIU laptop project students
Basic computers for DIU laptop project students
Alauddin Azad
 
Building Modern Digital Services on Scalable Private Government Infrastructur...
Building Modern Digital Services on Scalable Private Government Infrastructur...Building Modern Digital Services on Scalable Private Government Infrastructur...
Building Modern Digital Services on Scalable Private Government Infrastructur...
Andrés Colón Pérez
 
Ml2
Ml2Ml2
Intro to big data analytics using microsoft machine learning server with spark
Intro to big data analytics using microsoft machine learning server with sparkIntro to big data analytics using microsoft machine learning server with spark
Intro to big data analytics using microsoft machine learning server with spark
Alex Zeltov
 

Similar to Apache Thrift, a brief introduction (20)

2. RINA overview - TF workshop
2. RINA overview - TF workshop2. RINA overview - TF workshop
2. RINA overview - TF workshop
 
Server training
Server trainingServer training
Server training
 
Sap
SapSap
Sap
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
ODP Presentation LinuxCon NA 2014
ODP Presentation LinuxCon NA 2014ODP Presentation LinuxCon NA 2014
ODP Presentation LinuxCon NA 2014
 
Basic of computers
Basic of computers Basic of computers
Basic of computers
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
 
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
A Big Data Lake Based on Spark for BBVA Bank-(Oscar Mendez, STRATIO)
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
 
Music city data Hail Hydrate! from stream to lake
Music city data Hail Hydrate! from stream to lakeMusic city data Hail Hydrate! from stream to lake
Music city data Hail Hydrate! from stream to lake
 
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdfLEC_10_Week_10_Server_Configuration_in_Linux.pdf
LEC_10_Week_10_Server_Configuration_in_Linux.pdf
 
Presentation 1
Presentation 1Presentation 1
Presentation 1
 
.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles.NET Cloud-Native Bootcamp- Los Angeles
.NET Cloud-Native Bootcamp- Los Angeles
 
Oracle Cloud - Infrastruktura jako kód
Oracle Cloud - Infrastruktura jako kódOracle Cloud - Infrastruktura jako kód
Oracle Cloud - Infrastruktura jako kód
 
FlowER Erlang Openflow Controller
FlowER Erlang Openflow ControllerFlowER Erlang Openflow Controller
FlowER Erlang Openflow Controller
 
Ead pertemuan-7
Ead pertemuan-7Ead pertemuan-7
Ead pertemuan-7
 
Basic computers for DIU laptop project students
Basic computers for DIU laptop project studentsBasic computers for DIU laptop project students
Basic computers for DIU laptop project students
 
Building Modern Digital Services on Scalable Private Government Infrastructur...
Building Modern Digital Services on Scalable Private Government Infrastructur...Building Modern Digital Services on Scalable Private Government Infrastructur...
Building Modern Digital Services on Scalable Private Government Infrastructur...
 
Ml2
Ml2Ml2
Ml2
 
Intro to big data analytics using microsoft machine learning server with spark
Intro to big data analytics using microsoft machine learning server with sparkIntro to big data analytics using microsoft machine learning server with spark
Intro to big data analytics using microsoft machine learning server with spark
 

Recently uploaded

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 

Recently uploaded (20)

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 

Apache Thrift, a brief introduction

  • 1. -- Randy Abernethy, rx-m llc, 2014
  • 2. polyglotism • Modern distributed applications are rarely composed of modules written in a single language • Weaving together innovations made in a range of languages is a core competency of successful enterprises • Cross language communications are a necessity, not a luxury
  • 3. thrift • Apache Thrift – A high performance, scalable cross language serialization and RPC framework • What? – Full RPC Implementation - Apache Thrift supplies a complete RPC solution: clients, servers, everything but your business logic – Modularity - Apache Thrift supports plug-in serialization protocols: binary, compact, json, or build your own – Multiple End Points – Plug-in transports for network, disk and memory end points, making Thrift easy to integrate with other communications and storage solutions like AMQP messaging and HDFS – Performance - Apache Thrift is fast and efficient, solutions for minimal parsing overhead and minimal size – Reach - Apache Thrift supports a wide range of languages and platforms: Linux, OSX, Windows, Embedded Systems, Mobile, Browser, C++, Go, PHP, Erlang, Haskell, Ruby, Node.js, C#, Java, C, OCaml, ObjectiveC, D, Perl, Python, SmallTalk, … – Flexibility - Apache Thrift supports interface evolution, that is to say, CI/CD environments can roll new interface features incrementally without breaking existing infrastructure
  • 4. • Service Interfaces are described with the Apache Thrift Interface Definition Language (IDL) • Client/Server Stubs are generated with the Apache Thrift IDL Compiler • The IDL Compiler can generate stubs in over 15 languages • Existing code modules are easily converted into RPC services using the Apache Thrift Server Library rpcservices
  • 5. performance &reach • Thrift provides excellent performance for all but the most demanding solutions • Thrift provides broad reach, supporting a wide range of languages and platforms Custom Thrift REST Extreme Performance Extreme Reach High Performance Broad Reach Enterprise Compact Frameworks, C, etc. Web tech, scripting SOA, RPC Servers, Java, C#, C++, etc. WebEmbedded
  • 6. thriftidl 1. Define the service interface in IDL 2. Compile the IDL to generate client/server stubs 3. Connect the server stubs to the desired implementation 4. Choose an Apache Thrift server to host your service 5. Call RPC functions like local function using the client stubs #sail_stats.thrift service SailStats { double GetSailorRating(1: string SailorName) double GetTeamRating(1: string TeamName) double GetBoatRating(1: i64 BoatSerialNumber) list<string> GetSailorsOnTeam(1: string TeamName) list<string> GetSailorsRatedBetween(1: double MinRating, 2: double MaxRating) string GetTeamCaptain(1: string TeamName) }
  • 7. helloworld ~/thrift/hello $ ls -l -rw-r--r-- 1 dev dev 95 Mar 26 16:28 hello.thrift ~/thrift/hello $ thrift -gen py hello.thrift ~/thrift/hello $ ls -l drwxr-xr-x 3 dev dev 4096 Mar 26 16:31 gen-py -rw-r--r-- 1 dev dev 95 Mar 26 16:28 hello.thrift ~/thrift/hello $ ls -l gen-py drwxr-xr-x 2 dev dev 4096 Mar 26 16:31 hello -rw-r--r-- 1 dev dev 0 Mar 26 16:31 __init__.py ~/thrift/hello $ ls -l gen-py/hello -rw-r--r-- 1 dev dev 248 Mar 26 16:31 constants.py -rw-r--r-- 1 dev dev 5707 Mar 26 16:31 HelloSvc.py -rwxr-xr-x 1 dev dev 1896 Mar 26 16:31 HelloSvc-remote -rw-r--r-- 1 dev dev 46 Mar 26 16:31 __init__.py -rw-r--r-- 1 dev dev 398 Mar 26 16:31 ttypes.py ~/thrift/hello $ • Compiling IDL for an RPC service Generated Code • Interface Constants • HelloSvc Stubs • Sample Client • Package Init File • Interface Types
  • 8. helloserver • A Python RPC Server
  • 9. helloclient • A Python RPC Client
  • 10. compiled languages • A C++ RPC client #include <iostream> #include <string> #include <boost/shared_ptr.hpp> #include <thrift/transport/TSocket.h> #include <thrift/protocol/TBinaryProtocol.h> #include "gen-cpp/HelloSvc.h"" using namespace apache::thrift::transport; using namespace apache::thrift::protocol; using namespace boost; int main() { auto socket = make_shared<TSocket>("localhost", 8585); socket->open(); auto protocol = make_shared<TBinaryProtocol>(socket); HelloSvcClient client(protocol); std::string msg; client.hello_func(msg); std::cout << "[Client] received: " << msg << std::endl; }
  • 11. jvmlanguages • A Java RPC client operational
  • 12. .netlanguages • A C# RPC client
  • 13. • Apache Thrift uses a compiled IDL implementation – IDL is compiled generating stubs used at run time – Runtime serialization code allows for interface evolution • Apache Thrift IDL supports – Service Interface Definition – Type Definition • Service interfaces are exposed by Servers – Servers can implement many service interfaces – Interfaces can inherit from other interfaces • Types define serialization schemas – Types can be serialized to memory, disk or networks – Collections are supported (map, list, set) – Structures and Unions support composite types – DAGs are supported • New addition not widely implemented as of yet morethanrpc Interface Evolution Apache Thrift allows fields and parameters to be added and removed incrementally without breaking pre-existing code, allowing systems to grow incrementally over time (just like businesses) Particularly effective in dynamic CI/CD environments
  • 14. abstractand isolated • Crafting an effective IDL requires understanding some of the most important things about your system – What are the key entities in your system and how are they described – What are their cardinalities – What are their keys – Which are immutable – Can you define idempotent interfaces for mutations – What are the operational affinity groups in your system – What is your system model and how will state and services be distributed across it • All of these things bear directly on IDL design • Free of implementation, you can get the concepts right and then choose the best languages and tools to implement them
  • 15. entities&idl • Modern IDLs, like Apache Thrift, provide a rich set of tools for describing system entities (aka. messages) • Capturing and codifying the key system entities is prerequisite to effective interface specification • In some settings crafting the entities (e.g. an order) is all that the IDL need do Services are Optional!
  • 16. commschemes • Streaming – Communications characterized by an ongoing flow of bytes from a server to one or more clients. – Example: An internet radio broadcast where the client receives bytes over time transmitted by the server in an ongoing sequence of small packets. • Messaging – Message passing involves one way asynchronous, often queued, communications, producing loosely coupled systems. – Example: Sending an email message where you may get a response or you may not, and if you do get a response you don’t know exactly when you will get it. • RPC – Remote Procedure Call systems allow function calls to be made between processes on different computers. – Example: An iPhone app calling a service on the Internet which returns the weather forecast. Apache Thrift is an efficient cross platform serialization solution for streaming interfaces Apache Thrift provides a complete RPC framework
  • 17. architecture • User Code – client code calls RPC methods and/or [de]serializes objects – service handlers implement RPC service behavior • Generated Code – RPC stubs supply client side proxies and server side processors – type serialization code provides serialization for IDL defined types • Library Code – servers host user defined services, managing connections and concurrency – protocols perform serialization – transports move bytes from here to there
  • 18. • The Thrift framework was originally developed at Facebook and released as open source in 2007. The project became an Apache Software Foundation incubator project in 2008, after which four early versions were released. • 0.2.0 released 2009-12-12 • 0.3.0 released 2010-08-05 • 0.4.0 released 2010-08-23 • 0.5.0 released 2010-10-07 • In 2010 the project was moved to Apache top level status where several additional versions have been released. • 0.6.0 released 2011-02-08 • 0.6.1 released 2011-04-25 • 0.7.0 released 2011-08-13 • 0.8.0 released 2011-11-29 • 0.9.0 released 2012-10-15 • 0.9.1 released 2013-07-16 • 0.9.2 released 2014-06-01 • 1.0.0 released 2015-01-01 versions it is difficult to make predictions, particularly about the future. -- Mark Twain, Yogi Berra, etc. Open Source Community Developed Apache License Version 2.0
  • 19. resources • Web – thrift.apache.org – github.com/apache/thrift • Mail – Users: user-subscribe@thrift.apache.org – Developers: dev-subscribe@thrift.apache.org • Chat – #thrift • Book – Abernethy (2014), The Programmer’s Guide to Apache Thrift, Manning Publications Co. [http://www.manning.com/abernethy/] Chapter 1 is free Randy Abernethy ra@apache.org

Editor's Notes

  1. Roll the auto discussion into the non member begin/end discussion
  2. Roll the auto discussion into the non member begin/end discussion