What is gRPC?
gRPC is an open source remote procedure call framework originally developed at Google and now hosted by the Cloud Native Computing Foundation. Service methods and message types are declared in a Protocol Buffers interface file, compiled into client and server code, and transported over HTTP/2 with binary serialization. It supports unary calls and streaming in either or both directions.
In gRPC the contract comes first. A .proto file declares each service, its methods, and the request and response message types. A compiler then generates typed stubs for many languages, so a caller invokes what looks like a local method while the framework handles serialization, framing, and transport. This removes most hand written HTTP plumbing and keeps both sides in agreement.
Protocol Buffers encode messages in a compact binary form rather than text, which reduces payload size and parsing cost compared with verbose JSON. Field numbers rather than names carry identity on the wire, which is what makes careful field numbering essential: adding a new optional field is safe, but reusing a retired number breaks compatibility with older peers.
HTTP/2 provides multiplexed streams over one connection, so gRPC can express four call patterns: unary, server streaming, client streaming, and bidirectional streaming. This makes it a common choice for chatty internal service to service traffic and for long lived streams of events, where opening a fresh request per message would be wasteful.
The main limitation is reach. Browsers cannot speak raw gRPC because they lack the required control over HTTP/2 framing, so web clients typically use gRPC-Web through a proxy. Binary payloads are also harder to inspect by eye, which is why teams often keep a text-based gateway in front of gRPC services for debugging and third party access.
Key points
- Contract defined in a Protocol Buffers .proto file
- Binary encoding over HTTP/2, generated client stubs
- Unary plus three streaming call patterns
- Browsers need gRPC-Web and a proxy
- Never reuse retired field numbers
In practice
An internal inference service exposes a Predict method in a .proto file, taking a request message with an input string and returning a stream of token chunks. The compiler generates a Python server stub and a Go client stub from the same file. The Go caller invokes Predict and iterates the returned stream as chunks arrive, without writing any HTTP or serialization code by hand.