Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
gRPC vs REST: reach or speed?
Both are ways for services to talk over the network, and the honest answer is you often want both — in different places. REST over HTTP and JSON is universal: every language, browser, proxy and curl understands it, which makes it the right skin for public APIs. gRPC uses typed protobuf over HTTP/2: compact, fast, streaming, code-generated — the right plumbing between your own services.
The core difference: audience
REST models resources over plain HTTP with human-readable JSON. Its superpower is universality — nothing to install, cacheable by any proxy, debuggable with a browser or curl, understood everywhere. gRPC takes a contract-first approach: you define messages and services in a protobuf file and generate typed clients/servers in every language, sending compact binary over HTTP/2 with multiplexed streams and native streaming. Its superpower is efficiency and type safety between machines.
Exposing an API to the public, browsers, or partners? REST — universal tooling and debuggability win. High-volume, low-latency service-to-service traffic among your own polyglot services? gRPC — typed contracts, streaming, and smaller/faster payloads win.
Head to head
| Dimension | gRPC | REST |
|---|---|---|
| Payload | Protobuf (compact binary) | JSON (human-readable text) |
| Transport | HTTP/2 (multiplexed, streaming) | HTTP/1.1 or /2, request/response |
| Contract | Strongly typed .proto, codegen | Convention + OpenAPI (optional) |
| Streaming | Native (uni + bidirectional) | Awkward (SSE, polling, websockets) |
| Browser support | Needs a proxy (gRPC-Web) | Native everywhere |
| Debuggability | Needs tooling (binary) | curl, browser, any HTTP tool |
| Caching | Not by standard HTTP caches | Cacheable by any proxy/CDN |
| Best fit | Internal microservices, low latency | Public APIs, browser/partner clients |
When to use each — and both
Reach for gRPC
- Chatty internal service-to-service calls
- Polyglot teams wanting generated, typed clients
- Low latency / high throughput matters
- Streaming (real-time feeds, large transfers)
- Strict, versioned contracts (protobuf evolution)
Reach for REST
- Public or partner-facing APIs
- Browser clients (no proxy needed)
- You want curl-level debuggability
- HTTP caching / CDN benefits
- Broad, zero-friction adoption
REST at the edge, gRPC inside. Expose a public REST/JSON API for the world, and use gRPC for the fast, typed traffic between your own services behind it — often with an API gateway translating between them. You’re not choosing one forever; you’re placing each where its strength fits. See the API Design handbook for the full picture.
Why protobuf + HTTP/2 actually saves bytes and round-trips
The speed gap isn't marketing — it comes from two concrete mechanical differences. First, payload encoding: JSON repeats every field name as a string in every message ({"user_id": 42, "user_name": "..."}), while protobuf encodes each field as a small numeric tag defined once in the .proto schema — the wire format never re-sends "user_id" as text, just a tag byte and the value. For small messages the difference is modest; for high-volume internal traffic (millions of calls between services) it adds up to meaningfully less bandwidth and, just as importantly, less CPU spent parsing text into structured data on both ends.
Second, transport: REST over HTTP/1.1 opens one request per connection at a time (or relies on connection pooling to fake concurrency), while gRPC's HTTP/2 foundation multiplexes many concurrent calls over a single TCP connection — no HTTP-level head-of-line blocking between unrelated requests (a lost TCP packet still stalls every stream on the connection), and one long-lived connection instead of a pool of them, each with its own TLS handshake (HTTP/1.1 keep-alive avoids a handshake per call, but not per pooled connection). Combined with native bidirectional streaming (a single call that sends and receives a continuous sequence of messages, not just one request and one response), this is what makes gRPC a genuinely different tool for chatty internal traffic — many small, frequent calls between services — rather than just "REST but smaller."
Protobuf's compact tags require the schema to decode — you can't read a gRPC payload with your eyes the way you can curl a REST endpoint and see JSON. Efficiency on the wire trades away the "just look at it" debuggability that makes REST so approachable.
A worked scenario: a ride-hailing driver-location feed
Say a ride-hailing app needs to stream a driver's GPS position to the rider's app every second while a trip is active — and separately, expose a public API partners can query for trip receipts. These are genuinely different problems, and the comparison table above explains why they get different tools.
The driver-location stream is exactly gRPC's native case: a server-streaming RPC where the driver's phone opens one call and the server pushes a continuous sequence of position updates over it, multiplexed alongside dozens of other gRPC calls that phone might be making (trip status, chat messages) on the same HTTP/2 connection. Modeling this in REST would mean either polling ("GET /driver/location every second," wasteful and laggy) or reaching for Server-Sent Events or WebSockets — workable, but bolted onto HTTP rather than native to the protocol the way gRPC's streaming is.
The trip-receipt API for partners is exactly REST's native case: a partner's backend (maybe written in a language with no gRPC tooling investment, maybe just curling it from a script during integration testing) wants GET /v1/trips/{id}/receipt returning JSON it can read directly, cache at a CDN edge if it's immutable, and debug by pasting the URL into a browser. Forcing this through gRPC would mean every partner needs a gRPC-Web proxy and generated client code just to fetch a receipt — friction with no payoff, since receipt-fetching isn't high-frequency or latency-sensitive the way the location stream is.
The decision isn't "which protocol is better" — it's "who's the caller, and how often do they call." High-frequency, low-latency, internal-or-controlled callers favor gRPC. Low-frequency, must-be-universally-reachable, externally-debugged callers favor REST. Most real systems have both kinds of caller and use both protocols.
Common mistakes
| Mistake | Why it bites |
|---|---|
| Exposing gRPC directly to a public/partner audience | Every partner now needs gRPC tooling and codegen in their language before they can make a single call, and browsers can't speak raw gRPC at all without a gRPC-Web proxy — a huge adoption tax compared to "curl this URL." |
| Treating protobuf schema changes casually | Protobuf's wire format depends on field numbers staying stable — reusing a field number for a different field, or changing a field's type, silently corrupts data for any client still running the old schema. REST/JSON is more forgiving of ad-hoc field additions because field names, not positional numbers, carry the meaning. |
| Building bidirectional streaming on top of REST polling | Repeated polling for "has anything changed" wastes requests on the common case of "no" and adds latency up to the polling interval before a real change is seen — the exact problem gRPC's native streaming (or WebSockets) exists to avoid. |
| Assuming gRPC is always faster in practice | For small payloads over a fast local network, HTTP/1.1 REST overhead can be negligible, and the added complexity of protobuf schemas, codegen tooling, and gRPC-Web proxying may cost more in engineering time than it saves in milliseconds — measure before assuming. |
The picture: the same message on the wire
user_id and user_name, and it does that again in every message. Protobuf sends one tag byte per field. A tag is the field number shifted left three bits plus a wire type: 0 for a varint, 2 for length-prefixed bytes. Fields numbered 1 to 15 fit their tag in a single byte, so give those numbers to the fields you send most. The decoder needs the .proto to turn tag 1 back into user_id. That is the debuggability you trade away, and it is why reusing a field number corrupts data rather than failing loudly. An old client sees tag 2 and decodes the bytes as user_name, whatever the new schema meant by them. Numbers also explain the savings on integers: a varint uses one byte for values up to 127, so the 42 here costs one byte, not the two characters JSON spends on it.Cost and trade-offs: bytes, connections and operations
Here Time is effort or waiting, and Space is bytes or resources. The byte counts were measured. The first three rows show where gRPC’s size advantage holds, and where compression erases it.
| Case | Time | Space | Why |
|---|---|---|---|
| One small message | Protobuf decodes by reading tags and varints straight into a generated struct | JSON 32 B, protobuf 7 B | Field names are on the wire in every JSON message, and never in protobuf. |
| 100 such records, uncompressed | Same decoding cost per record | JSON 3,921 B, protobuf 1,420 B | Protobuf is about a third of the size. |
| The same 100 records, gzipped | Compressing and decompressing costs CPU on both ends | JSON 547 B, protobuf 629 B | gzip strips JSON’s repeated names. On this repetitive sample, JSON ends up smaller. Size alone rarely justifies gRPC; parse cost and the connection model do. |
| 50 concurrent calls to one service | In practice HTTP/1.1 has one request in flight per connection, so 50 calls need 50 connections or a queue | HTTP/2: one connection carrying 50 streams | One lost TCP packet still stalls every stream on that connection. HTTP/2 removes head-of-line blocking at the HTTP layer, not at the TCP layer. HTTP/3 over QUIC addresses the second. |
| Load balancing | A layer-4 balancer pins a long-lived HTTP/2 connection, and every call on it, to one backend | You need an L7 proxy such as Envoy, or client-side balancing | REST over short or pooled HTTP/1.1 connections spreads load with no extra work. This is gRPC’s most common production surprise. |
| Live location for a 20-minute trip | Polling every 1 s: an update waits up to 1 s, about 0.5 s on average | Polling: 20 × 60 = 1,200 requests. Streaming: 1 call | The page’s driver feed. Most of those 1,200 polls are part of the waste the page describes. |
| Adding or retiring a field | Add a field with a new number: old clients skip what they do not know | Mark retired numbers reserved so nobody reuses them | JSON clients ignore unknown names too. Protobuf adds the rule that numbers are forever. |
| Debugging a live call | REST: curl and read the output | gRPC: grpcurl plus server reflection or the .proto file | Enable reflection in staging. Without it, a binary payload is unreadable. |
| Calling from a browser | Browsers do not expose HTTP/2 frames or trailers to JavaScript, so raw gRPC cannot run there | A gRPC-Web proxy, such as Envoy, translates. It supports unary and server-streaming calls only | Client streaming and bidirectional streaming, gRPC’s headline features, do not reach the browser. Use WebSockets for those. |
| Reporting errors | gRPC returns its own status codes, such as NOT_FOUND, UNAVAILABLE and DEADLINE_EXCEEDED, in trailers | REST uses HTTP status codes that every proxy, log and dashboard already understands | Your gRPC monitoring must read the gRPC status. A failed call still travels as an HTTP 200. |
| Sharing the contract | One .proto generates clients in every language, so a mismatch fails at compile time | REST: an OpenAPI file, if someone keeps it current | Codegen is a build step every consumer must run. That is cheap inside one company and friction for partners. |
| Timeouts across a call chain | gRPC sends a deadline with each call, and a server can pass the time left to its own downstream calls | REST: you invent a header and plumb it through yourself | Without deadline propagation, a slow leaf keeps working for a caller that has already given up. |
Read the table as two lists. gRPC wins on structure: generated types, streaming, multiplexing and deadlines. Its byte advantage is real uncompressed, but much smaller once both sides compress. REST wins on operations: any load balancer works, any tool can read it, and caching is free. The connection rows are the ones teams learn the hard way. Plan the L7 balancing before the first gRPC service goes live, not after one backend runs hot while the rest sit idle. And measure before you migrate. If your REST traffic is already compressed and the services are not CPU-bound on JSON parsing, the gain may be smaller than the cost of codegen, proxies and new tooling. The page’s last mistake says the same thing.
Which would you pick?
Three situations. Pick the side you'd actually build — the explanation follows.
A partner-facing API that outside companies will integrate with, in languages you do not control.
Exposing gRPC to a public or partner audience means every integrator needs gRPC tooling and codegen in their language before making a single call, and browsers cannot speak raw gRPC at all. That adoption tax usually outweighs the wire efficiency — the page frames this choice as being about audience, not speed.
Two internal services exchange millions of small messages per minute inside your own network, both owned by your team.
This is the audience gRPC is for: callers you control, high message volume, no browser in the path. Consistency with a public API is a weak reason to pay JSON parsing and header overhead millions of times a minute, and compression reduces bytes without addressing per-request overhead or round trips.
A protobuf field is no longer used, so a developer reuses its field number for a new field of a different type.
Protobuf's wire format depends on field numbers staying stable: meaning is carried by the number, not the name. An old client reading the new field decodes it as the old one and produces garbage with no error. "Unused" refers to your code, not to clients still running, and coordinated redeploys do not cover in-flight or persisted messages.
Quick answers
What is the difference between gRPC and REST?
REST sends human-readable JSON over standard HTTP and is universal, cacheable and debuggable — ideal for public APIs. gRPC sends compact binary protobuf over HTTP/2 with typed, generated clients and native streaming — ideal for fast internal service-to-service calls. REST optimizes for reach; gRPC for efficiency and type safety.
Is gRPC faster than REST?
Generally yes for service-to-service traffic: protobuf payloads are smaller than JSON, HTTP/2 multiplexes many calls over one connection, and there is no text parsing overhead. But the gain matters most at high volume and low latency; for a public API, REST’s universality usually outweighs raw speed.
Can I use gRPC in the browser?
Not directly — browsers can’t speak raw gRPC, so you need a proxy layer like gRPC-Web or a REST/JSON gateway. This is a big reason REST remains the default for public and browser-facing APIs, while gRPC shines between backend services.
Should I use gRPC or REST?
Use REST at the edge for public, browser and partner APIs where universality and debuggability win. Use gRPC inside for chatty, low-latency, polyglot service-to-service traffic where typed contracts and streaming win. Many systems use both, with a gateway translating between them.
gRPC vs REST: spell it out, or agree on a phrasebook first
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Handbooks
- The System Design Fundamentals HandbookThe load-bearing ideas behind every distributed system — the CAP theorem and consistency models, concurrency and locking, partitioning and replication, and consensus and coordination — each tied to a real worked design you can study interactively.Read →
- CAP Theorem & Consistency ModelsWhat a distributed system can promise when the network splits — CP vs AP, why "CA" is a myth, PACELC, and the full spectrum from linearizable to eventual consistency. Part of System Design Fundamentals.Read →
- Partitioning, Sharding & ReplicationHow one dataset becomes many — range vs hash partitioning, consistent hashing and virtual nodes, hot partitions, replication topologies, replication lag, and quorums. Part of System Design Fundamentals.Read →
- Consensus, Transactions & CoordinationHow nodes that can crash still agree on one truth — majority quorums, Raft and Paxos, leader election, two-phase commit vs the saga pattern, and idempotency for exactly-once effects. Part of System Design Fundamentals.Read →
- The Kubernetes HandbookThe one idea under all the YAML — declare desired state, and a control loop makes reality match. Covers the orchestration problem, pods, deployments and replicasets, services and networking, the reconciliation loop and self-healing, the scheduler, config/secrets and health probes, autoscaling, and when you actually need Kubernetes.Read →
- The Observability HandbookSeeing inside production — monitoring vs observability, the three pillars (metrics, logs, traces) and what each answers, structured logging, metric types and the cardinality trap, distributed tracing, the golden signals and SLIs/SLOs/error budgets, alerting on symptoms not causes, and correlating all three during an incident.Read →