rpc framework
TRANSCRIPT
![Page 1: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/1.jpg)
RPC Framework
![Page 2: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/2.jpg)
SOAP vs. REST
![Page 3: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/3.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/4.jpg)
RPC
![Page 5: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/5.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/6.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/7.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/8.jpg)
• 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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/9.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/10.jpg)
gRPC
![Page 11: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/11.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/12.jpg)
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](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/13.jpg)
Thrift
![Page 14: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/14.jpg)
Avro
• Doug Cutting• RPC 호출 과 파일에 데이터 저장하는 기능• Hadoop의 RPC를 Avro RPC로 교체• MS : .Net 용 Avro 개발 사용 중.
• Dynamic schema• Schema in JSON• No need to compile
![Page 15: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/15.jpg)
Serialize Benchmark
* https://github.com/eishay/jvm-serializers/wiki
Time
![Page 16: Rpc framework](https://reader030.vdocuments.mx/reader030/viewer/2022020203/5a64f04a7f8b9a127f8b468f/html5/thumbnails/16.jpg)
Serialize Benchmark
Size