You are on page 1of 17

RPC Framework

SOAP vs. REST

SOAP : Simple Object Access Protocol


REST : Representational State Transfer
Beyond REST

OSFA
Multiple Round Trips
Versioning
REST endpoints are usually weakly-typed and
lack machine-readable metadata
Additional Use Cases
: REST
RPC

Remote Procedure Call


IDL : Interface Definition language
Stub, Skeleton
Serialization/Deserialization(Marshaling/Unmarshaling)
RPC Design Considerations

Well understood problems from last decade:


Data types (what kind of data can I encode)
Protocol (what is the encoding/representation)
Transport (method to transport it)
Features (language support, IDL)
Efficiency (how much time/space?)

Ongoing problems to solve:


Ease of programmer use (specifying IDL contract and
backward/forward compatibility, versioning)
Ease of debuggability
RPC (vs. REST)

IDL API ( )
( ) API Generate
.
/ (as a Native
Object) .
( ) , API
.
REST , ( )
.
Hessian

The Hessian binary web service protocol makes web


services usable without requiring a large framework
Without learning yet another alphabet soup of protocols.

Java, Python, C++, .Net C#, PHP


Java : version 4.0.51 - 2017/03/29
Creating a Hessian Service

1. Create an Java interface as the public API


2. Create a client using HessianProxyFactory
3. Create the Service implementation class
4. Configure the service in your servlet engine.
gRPC

stubby -> Protocol Buffer(2008)


PB : Google, ActiveMQ, Netty
gRPC : 2015,
Netflix, CoreOS, Cisco/Juniper

Streaming, Bidirectional streaming


Built-in security and authentication
SSL/TLS, Oauth, JWT access
Layering on top of HTTP/2 standard
Performance: Binary protocol, Stream multiplexing
Interoperability with 3rd party proxies, tools,
libraries
App-level Flow control, Call-cancellation
Rich features
Load balancing, Tracing, Tooling ecosystem (cmdline
tool)...
gRPC

1. Define a service in a .proto file using Protocol Buffers IDL


2. Generate server and client code using the protocol buffer
compiler with grpc plugin
protoc --java_out=. sample.proto
3. Use the gRPC API to write a simple client and server for your
service in the languages of your choice
gRPC
Thrift

x-googler developed at Facebook


open sourced in April 2007
Facebook, Evernote, Cassandra Client API, LastFM

gRPC(PB)
: thrift --gen <language> <Thrift filename>
3 common IDL container types(lists, sets, maps)
Thrift

Auto generated PolyGlot clients.


% thrift --gen java user.thrift
gen-java : User.java, UserService.java

Multiple servers to choose from


TSimpleServer : Simple single threaded
server
TThreadPoolServer : Uses Java's built in
ThreadPool management
TNonblockingServer : non-blocking TServer
implementation
THsHaServer : extension of the
TNonblockingServer to a HalfSync/Half-Async
server
Thrift
Avro

Doug Cutting
RPC
Hadoop RPC Avro RPC
MS : .Net Avro .

Dynamic schema
Schema in JSON
No need to compile
Serialize Benchmark

* https://github.com/eishay/jvm-serializers/wiki
Time
Serialize Benchmark

Size

You might also like