rpc framework

Download Rpc framework

Post on 22-Jan-2018




1 download

Embed Size (px)


  1. 1. RPC Framework
  2. 2. SOAP vs. REST
  3. 3. Beyond REST OSFA Multiple Round Trips Versioning REST endpoints are usually weakly-typed and lack machine-readable metadata Additional Use Cases : REST
  4. 4. RPC
  5. 5. 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
  6. 6. 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
  7. 7. 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.
  8. 8. 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
  9. 9. 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 3. Use the gRPC API to write a simple client and server for your service in the languages of your choice
  10. 10. gRPC
  11. 11. 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)
  12. 12. 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
  13. 13. Thrift
  14. 14. Avro Doug Cutting RPC Hadoop RPC Avro RPC MS : .Net Avro . Dynamic schema Schema in JSON No need to compile
  15. 15. Serialize Benchmark * https://github.com/eishay/jvm-serializers/wiki Time
  16. 16. Serialize Benchmark Size