rpc framework
TRANSCRIPT
RPC Framework
SOAP vs. REST
Beyond REST
• OSFA
• Multiple Round Trips
• Versioning
• REST endpoints are usually weakly-typed and
lack machine-readable metadata
• Additional Use Cases
• 요약 : REST 가 간결하나 기능적 한계
RPC
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
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 API2. Create a client using HessianProxyFactory3. Create the Service implementation class4. Configure the service in your servlet engine.
• 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
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
gRPC
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)
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
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