rpc framework

16
RPC Framework

Upload: july-mon

Post on 22-Jan-2018

132 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Rpc framework

RPC Framework

Page 2: Rpc framework

SOAP vs. REST

Page 3: Rpc framework

Beyond REST

• OSFA

• Multiple Round Trips

• Versioning

• REST endpoints are usually weakly-typed and

lack machine-readable metadata

• Additional Use Cases

• 요약 : REST 가 간결하나 기능적 한계

Page 4: Rpc framework

RPC

Page 5: Rpc framework

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 b

ackward/forward compatibility, versioning)

● Ease of debuggability

Page 6: Rpc framework

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

Page 7: Rpc framework

Creating a Hessian Service

1. Create an Java interface as the public API2. Create a client using HessianProxyFactory3. Create the Service implementation class4. Configure the service in your servlet engine.

Page 8: Rpc framework

• 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

Page 9: Rpc framework

gRPC

1. Define a service in a .proto file using Protocol Buffers IDL2. Generate server and client code using the protocol buffer

compiler with grpc plugin3. Use the gRPC API to write a simple client and server for

your service in the languages of your choice

Page 10: Rpc framework

gRPC

Page 11: Rpc framework

Thrift

• x-googler developed at Facebook• open sourced in April 2007• Facebook, Evernote, Cassandra Client API, LastFM

• gRPC(PB)와 차이점• thrift• 3 common IDL container types(lists, sets, maps)

Page 12: Rpc framework

Thrift

• Auto generated PolyGot 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

Page 13: Rpc framework

Thrift

Page 14: Rpc framework

Avro

• Doug Cutting• RPC 호출 과 파일에 데이터 저장하는 기능• Hadoop의 RPC를 Avro RPC로 교체• MS : .Net 용 Avro 개발 사용 중.

• Dynamic schema• Schema in JSON• No need to compile

Page 15: Rpc framework

Serialize Benchmark

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

Time

Page 16: Rpc framework

Serialize Benchmark

Size