Skip to the page

gRPC · Concept

The four kinds of gRPC call

The interviewer asks

gRPC has unary calls and three kinds of streaming. Explain each one with a real example from a delivery app, and tell me what happens on the wire.

Then

Follow-ups the interviewer asks next

  1. What does HTTP/2 give gRPC that HTTP/1.1 can't?
  2. How does an error come back in a stream?
  3. The rider app streams location points faster than the server can save them. What happens?
  4. Can a load balancer move a long stream to a new pod?
  5. What are metadata and status codes?
  6. When would you avoid streaming?

The answer

What a strong answer covers

  • Unary: one request, one response (GetOrder). Server streaming: one request, many responses (WatchOrderStatus sends changes until delivery). Client streaming: many requests, one response (the rider app sends location points, gets one summary). Bidirectional: both sides send on one stream independently (dispatch and rider exchanging offers and acks).
  • On the wire: each call is an HTTP/2 stream on a long-lived connection; messages are length-prefixed protobuf frames; the call ends with trailers carrying grpc-status and grpc-message. Many calls share one connection (multiplexing), with compressed headers.
  • Errors: a status code (OK, INVALID_ARGUMENT, NOT_FOUND, DEADLINE_EXCEEDED, UNAVAILABLE, RESOURCE_EXHAUSTED, …), optionally with rich details. In a stream the status comes at the end and closes it.
  • Back-pressure: HTTP/2 flow-control windows make a fast writer wait for a slow reader (some APIs buffer instead, so watch memory).
  • A stream can't be load-balanced once it has started; servers set a maximum connection age and clients reconnect and resume from the last event they saw.
  • Metadata: key-value headers for the auth token, request id and trace context.
  • Avoid streaming when unary works: harder to debug, balance and retry. gRPC's docs note that in Python, streaming calls are much slower than unary ones.

The red pen

Common traps

Avoid:"gRPC is just faster REST"; not knowing that the status arrives in trailers; streams for everything.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview