gRPC is a high-performance RPC framework:
Protocol Buffers (protobuf):
message User {
int32 id = 1;
string name = 2;
}
- Binary serialization (smaller, faster than JSON)
- Schema-defined contracts
- Code generation for multiple languages
gRPC features:
- HTTP/2 transport (multiplexing, streaming)
- Four patterns: unary, server streaming, client streaming, bidirectional
- Built-in load balancing and auth
Use gRPC for internal microservice communication. Use REST/GraphQL for public APIs.