Skip to content
StackDecode
System Design
2. Networking FundamentalsAnimated

gRPC

Fast binary RPC over HTTP/2 with typed contracts.

The idea

gRPC uses Protocol Buffers for compact messages and generated clients, with streaming support.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Client stubgRPC serverHTTP/2 + protobuf: GetUser(id=7)
  • current message
  • earlier
  • failure or attack

A generated stub serialises the call to compact binary.

step:
1/4
from:
Client stub
to:
gRPC server
1/4

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Define a service in a .proto file
  2. 2Generate client and server code
  3. 3Call a method like a local function
  4. 4Messages travel as binary over HTTP/2

Where it is used

Service-to-service calls.

Watch out for

Hard to call directly from browsers without a proxy.

Related