← Study Notes Backend


Backend

gRPC

A high-performance RPC framework using Protocol Buffers over HTTP/2 — binary, strongly typed, with streaming and code-generated clients in many languages. It is ideal for low-latency service-to-service calls inside a system. The trade-off: not human-readable and awkward to call from browsers without a proxy layer, so it is rare on public edges.


Purpose

gRPC is a high-performance remote procedure call framework: you define services and messages in Protocol Buffers, and it generates typed client and server code that talk in a compact binary format over HTTP/2. It exists to make internal service-to-service calls fast, strongly typed and cross-language.

When to Use It

It fits chatty internal microservices, low-latency backends and polyglot systems where a shared .proto contract keeps teams in sync. Its first-class streaming suits telemetry, feeds and bidirectional channels.

It is a poor fit for public, browser-facing APIs, which cannot speak raw gRPC without a proxy (gRPC-Web) and where readable JSON is expected.

Trade-offs

You gain speed, small payloads, streaming and generated clients; you give up human readability and easy ad-hoc debugging (binary frames), and you add a code-generation build step. Browser support needs an extra proxy layer.

Implementation

Write the .proto schema, generate stubs for each language, and run services over HTTP/2 with TLS. Evolve messages by only adding fields (never reuse or renumber tags) to stay backward-compatible, and use deadlines, retries and interceptors for auth and tracing.