← Lessons

quiz vs the machine

Gold1480

Networking

gRPC Over HTTP2

How gRPC maps remote calls and streaming onto HTTP2 streams.

5 min read · core · beat Gold to climb

What gRPC Adds

gRPC is a framework for calling methods on a remote service as if they were local. It defines services in a schema and runs the calls over HTTP2, reusing its multiplexed streams.

Mapping A Call

Each remote call becomes one HTTP2 stream.

  • The method name travels in the request path.
  • Arguments and results are encoded as binary messages, usually with protocol buffers.
  • Trailers at the end carry a status code that reports success or an error.

Because each call is its own stream, many calls run in parallel on one connection.

Four Call Shapes

gRPC supports more than a single request and response.

  • Unary: one request, one response.
  • Server streaming: one request, a stream of responses.
  • Client streaming: a stream of requests, one response.
  • Bidirectional: both sides stream at once over the same stream.

Streaming maps naturally onto the framing that HTTP2 already provides.

Why It Is Efficient

Binary messages are compact, headers are compressed, and one connection serves many calls. This makes gRPC popular for service to service traffic inside a cluster.

Key idea

gRPC maps each remote call onto an HTTP2 stream with binary messages and status trailers, supporting unary and streaming shapes for efficient service to service communication.

Check yourself

Answer to earn rating on the learn ladder.

1. How does gRPC use HTTP2?

2. Where does a gRPC call report its final status?

3. Which call shape streams in both directions at once?