gRPC is an open-source remote procedure call (RPC) framework, first developed at Google, that lets one service call methods on another as if they were local functions. Services are defined in Protocol Buffers files, messages travel in a compact binary format over HTTP/2, and gRPC generates client and server code for many languages.

How gRPC Works

gRPC defines services and messages in .proto files, then generates strongly-typed client and server code in any language. A Go service can call a Python service as naturally as calling a local function. HTTP/2 enables multiplexing, streaming, and header compression.

gRPC supports four communication patterns: unary (request-response), server streaming, client streaming, and bidirectional streaming. This flexibility makes it ideal for real-time data processing and inter-service communication.

Why Developers Use gRPC

Use gRPC for internal microservice communication where performance matters. Companies like Netflix, Dropbox, and Google use gRPC between services. For external/browser-facing APIs, stick with REST or GraphQL since browsers don't natively support gRPC.

Key Concepts

  • Protocol Buffers — Binary serialization format that's smaller and faster than JSON — defined in .proto files
  • HTTP/2 — Transport protocol that enables multiplexing, streaming, and header compression
  • Code Generation — gRPC auto-generates typed client/server code from .proto files in Go, Python, Java, C++, etc.
  • Streaming — gRPC supports server-side, client-side, and bidirectional streaming — beyond simple request-response

Frequently Asked Questions

What is gRPC used for?

gRPC is mostly used for service-to-service calls inside a backend, such as between microservices, where typed contracts, streaming and small binary messages help. Browsers cannot call gRPC services directly, so public web APIs usually stay on REST or reach gRPC through gRPC-Web and a proxy.

When should I use gRPC instead of REST?

Use gRPC for high-throughput internal service communication, streaming data, and polyglot microservices. Use REST for browser-facing APIs, simplicity, and when you need broad client compatibility.

Can browsers use gRPC?

Not directly. Browsers don't support HTTP/2 trailers needed by gRPC. Use gRPC-Web (a proxy layer) or envoy proxy to bridge the gap.