Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Building Language
Agnostic APIs with gRPC
Java Day İstanbul
6 May 2017
Mustafa Akın
A high performance, open-source universal
RPC framework
www.grpc.io
Quick Back Story
• Google has been using its own RPC framework
Stubby to communicate millions of micro-services
for over a...
Web Services in 2007
Web Services in 2017
Why would you want to use
gRPC?
• Quickly build APIs and avoid writing request/response parser
codes
• Use the language yo...
How does gRPC Work?
• You define your service in Protocol Buffers format.
• From a .proto file, server-side and client-side ...
In short, gRPC allows you to define your
service, generate boilerplate codes for you and
you only have to write your busine...
Protocol Buffers
• IDL: Interface Definition Language
• Data Model: Request and Response are Structured
• Wire Format: Bina...
Protocol Buffers vs JSON
Binary Encoded Text Encoded
Decoding requiredRapidly parseable
Example gRPC Proto
Java Client Code
Java Server Code
Python Client Code
Python Server Code
Go Client Code
Go Server Code
Ruby Client Code
Ruby Server Code
Streaming Services in gRPC
• Simple RPC: Request and response
• Server-side streaming RPC: Client makes a request and
then...
Language support in gRPC
• C++
• Java
• Python
• Go
• Ruby
• Android
• NodeJS
• Objective-C
• PHP
Principles of gRPC
• Services not Objects, Messages not References
• Coverage & Simplicity
• Free & Open
• Interoperabilit...
Principles of gRPC
• Payload Agnostic
• Streaming
• Blocking & Non-Blocking
• Cancellation & Timeout
• General Purpose & P...
Principles of gRPC
• Flow-Control
• Pluggable
• Extensions as APIs
• Metadata Exchange
• Standardized Status Codes
Who uses gRPC?
• Square
• Docker
• Kubernetes
• Coreos
• Cisco
• Juniper Networks
• Netflix
You can contact me by e-mail at:
mustafa91@gmail.com
twitter: @mustafaakin
Any questions?
Thank you for listening.
Upcoming SlideShare
Loading in …5
×

Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017

My presentation about gRPC on Java Day Istanbul 06 May 2017 event.

  • Login to see the comments

Building Language Agnostic APIs with gRPC - JavaDay Istanbul 2017

  1. 1. Building Language Agnostic APIs with gRPC Java Day İstanbul 6 May 2017 Mustafa Akın
  2. 2. A high performance, open-source universal RPC framework www.grpc.io
  3. 3. Quick Back Story • Google has been using its own RPC framework Stubby to communicate millions of micro-services for over a decade. 10^10 RPC calls per second. • A uniform and cross-platform RPC allowed efficiency and quick deployment and development. • However Stubby was tied to Google internals, therefore they rebuilt it with newer technologies such as HTTP/2 to extend its usage, and open source gRPC was born
  4. 4. Web Services in 2007
  5. 5. Web Services in 2017
  6. 6. Why would you want to use gRPC? • Quickly build APIs and avoid writing request/response parser codes • Use the language you desire interchangeably for client-server roles • Avoid on-the-fly parsing by imposing a pre-established schema and have low latency and highly scalable system • Use bi-directional streaming instead of classical request- response APIs • Use HTTP/2.0 for having millions of streams over a single- connection
  7. 7. How does gRPC Work? • You define your service in Protocol Buffers format. • From a .proto file, server-side and client-side code are generated for your favourite languages • You extend the generated code and implement the required interfaces only and start listening on a port • In same or another language, you can use the generated client code to connect to your server, avoiding writing any boilerplate code.
  8. 8. In short, gRPC allows you to define your service, generate boilerplate codes for you and you only have to write your business logic. You can decide on the service definition initially, and let client and server to be developed independently. You can also easily upgrade your service definitions with gRPC.
  9. 9. Protocol Buffers • IDL: Interface Definition Language • Data Model: Request and Response are Structured • Wire Format: Binary, because computers do not need human-readable!
  10. 10. Protocol Buffers vs JSON Binary Encoded Text Encoded Decoding requiredRapidly parseable
  11. 11. Example gRPC Proto
  12. 12. Java Client Code Java Server Code
  13. 13. Python Client Code Python Server Code
  14. 14. Go Client Code Go Server Code
  15. 15. Ruby Client Code Ruby Server Code
  16. 16. Streaming Services in gRPC • Simple RPC: Request and response • Server-side streaming RPC: Client makes a request and then server sends many responses over time until there are no more. • Client-side streaming RPC: Client makes many requests over time, server reads them and sends a single response at the end. • Bi-directional streaming RPC: Both client and server sends each other messages over time and both streams can be independent.
  17. 17. Language support in gRPC • C++ • Java • Python • Go • Ruby • Android • NodeJS • Objective-C • PHP
  18. 18. Principles of gRPC • Services not Objects, Messages not References • Coverage & Simplicity • Free & Open • Interoperability & Reach • General Purpose & Performant • Layered
  19. 19. Principles of gRPC • Payload Agnostic • Streaming • Blocking & Non-Blocking • Cancellation & Timeout • General Purpose & Performant • Lameducking
  20. 20. Principles of gRPC • Flow-Control • Pluggable • Extensions as APIs • Metadata Exchange • Standardized Status Codes
  21. 21. Who uses gRPC? • Square • Docker • Kubernetes • Coreos • Cisco • Juniper Networks • Netflix
  22. 22. You can contact me by e-mail at: mustafa91@gmail.com twitter: @mustafaakin Any questions? Thank you for listening.

×