gRPC Remote Procedure Call
ActiveHigh-performance, open-source RPC framework from Google using HTTP/2 for transport and Protocol Buffers for serialization. Supports unary, server streaming, client streaming, and bidirectional streaming RPCs.
In one line
gRPC is a high-performance RPC framework developed by Google and open-sourced in 2015. It uses HTTP/2 for transport, Protocol Buffers (protobuf) for serialization, and generates type-safe client/server stubs from .proto schema files. gRPC supports four service patterns: unary (request/response), server streaming, client streaming, and bidirectional streaming. It is widely used for internal microservice communication and is the protocol underlying Kubernetes API server communication, etcd, and many cloud-native systems.
Quick Reference
| Field | Size | Description |
|---|---|---|
| Transport | — | HTTP/2 mandatory (h2) |
| Serialization | variable | Protocol Buffers binary encoding |
| Content-Type | — | application/grpc |
| HTTP status | — | Always 200; gRPC status in trailer Grpc-Status |
| Grpc-Status | 4 bytes | gRPC status code (0 = OK, 1–16 = errors) |
| Grpc-Message | variable | URL-encoded error description |
| Length-prefix | 5 bytes | 1-byte compressed flag + 4-byte message length |
Key Characteristics
Four service patterns
Unary, server streaming, client streaming, and bidirectional streaming over a single HTTP/2 connection.
Code-first schema
Services defined in .proto files. Stubs generated for 11+ languages from a single source of truth.
Binary efficiency
Protocol Buffers encoding is 5–10x smaller than JSON and significantly faster to serialize/deserialize.
Type-safe contracts
Schema enforced at compile time via generated stubs. Breaking changes caught before deployment.
Message Format
gRPC Unary RPC over HTTP/2:
HEADERS frame:
:method = POST
:path = /helloworld.Greeter/SayHello
:scheme = https
:authority = api.example.com
content-type = application/grpc
te = trailers
DATA frame (length-prefixed protobuf):
[0x00][0x00 0x00 0x00 0x0D][protobuf bytes]
^compressed ^message lengthgRPC Unary Response:
HEADERS frame:
:status = 200 content-type = application/grpc
DATA frame:
[0x00][0x00 0x00 0x00 0x12][protobuf bytes]
HEADERS (trailers):
grpc-status = 0
grpc-message = (empty on success)