gRPC is a high-performance, open-source remote procedure call (RPC) framework that uses Protocol Buffers for serialization and HTTP/2 for transport, enabling efficient communication between services. You define service interfaces and message types in .proto files; gRPC generates client and server code in your language, handling serialization, networking, and error handling. Clients call remote methods as if they were local function calls. The differences from REST are substantial. REST exchanges text-based JSON over HTTP/1.1 with separate connections per request. gRPC uses binary protobuf over HTTP/2 with multiplexed streams on persistent connections. Binary encoding is more compact; multiplexing eliminates connection overhead. gRPC natively supports four communication patterns: unary (single request, single response), server streaming (single request, multiple responses), client streaming (multiple requests, single response), and bidirectional streaming (multiple requests and responses interleaved). This flexibility enables real-time data feeds, file uploads, and interactive applications that REST handles awkwardly. Performance benchmarks typically show gRPC achieving 2-10x better throughput and lower latency than equivalent REST APIs. For internal microservice communication where you control both ends, gRPC is often the better choice. For public APIs with diverse clients, REST remains more practical due to broader tooling and browser support.
Back to Glossary