gRPC makes a remote call look like a typed service method#
service UserService {
rpc GetUser(GetUserRequest) returns (User);
}A .proto service definition describes methods and messages. Tooling generates client and server code, Protocol Buffers provide a binary wire representation, and gRPC commonly uses HTTP/2 for concurrent calls and streaming.
Calls can be unary, server-streaming, client-streaming, or bidirectional streaming. Streams are useful for a long-lived logical flow, but add lifecycle, deadline, load-balancing, and failure-handling questions.
Choose from the consumers and operating environment#
| Requirement | REST | gRPC |
|---|---|---|
| Public web API | Often a strong fit | Less direct |
| Internal service calls | Good | Often a strong fit |
| Human-readable payload | Commonly JSON | Usually binary |
| Streaming | Possible through several mechanisms | Native RPC patterns |
| Browser support | Excellent | Additional considerations |
| Strict contract | Schema-dependent | Strong interface definition |
Generated contracts improve consistency but make schema evolution and tooling part of the platform. Binary payloads are not as convenient to inspect manually. A small internal CRUD application may be better served by familiar HTTP JSON rather than adding another protocol.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.