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
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. 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. 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. Protocol Buffers
• IDL: Interface Definition Language
• Data Model: Request and Response are Structured
• Wire Format: Binary, because computers do not
need human-readable!
10. Protocol Buffers vs JSON
Binary Encoded Text Encoded
Decoding requiredRapidly parseable
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. Language support in gRPC
• C++
• Java
• Python
• Go
• Ruby
• Android
• NodeJS
• Objective-C
• PHP
18. Principles of gRPC
• Services not Objects, Messages not References
• Coverage & Simplicity
• Free & Open
• Interoperability & Reach
• General Purpose & Performant
• Layered