Architecture · October 22, 2026 · Daniel Murillo
gRPC vs REST: communication between microservices
gRPC is not faster REST. Contracts, streaming, and when it fits internal services versus a public API.
gRPC is not simply “faster REST”. It is a remote-call model with contracts, code generation, and streaming capabilities, designed for scenarios where those characteristics add value.
Introduction
When a platform grows and splits responsibilities across services, internal communication becomes an important part of its architecture. REST offers interoperability and a simple HTTP interface. gRPC brings contracts defined with Protocol Buffers, generated clients, and streaming over HTTP/2.
The question is not which technology wins every benchmark. It is which one better fits the communication needs, languages, infrastructure, and operational capacity of the team.
1. REST model
A REST API usually exposes resources through URLs and HTTP methods:
GET /api/products/123
The contract can be documented with OpenAPI and the response usually uses JSON. This makes integration with browsers, tools, and external systems easier.
REST is especially convenient at public boundaries and when interoperability matters. It can also directly leverage HTTP cache semantics for compatible operations.
2. gRPC model
gRPC defines services and messages in .proto files:
syntax = "proto3";
service ProductService {
rpc GetProduct (GetProductRequest)
returns (ProductResponse);
}
message GetProductRequest {
string id = 1;
}
message ProductResponse {
string id = 1;
string name = 2;
double price = 3;
}
From the contract you can generate clients and servers for compatible languages. This helps consistency across services and reduces the need to hand-build every client.
gRPC usually uses Protocol Buffers and HTTP/2. The binary format can reduce size and processing cost in certain scenarios, but the benefit depends on the message and the implementation.
3. Why it can be efficient
Performance can benefit from:
- Binary messages with a schema.
- Generated clients.
- Reused connections and channels.
- HTTP/2 multiplexing.
- Streaming for data flows.
- Contracts that make types explicit.
But serialization rarely explains all of the response time by itself. A gRPC call that waits on a slow query or an external service will still be slow.
4. Channels, deadlines, and cancellation
You should not create a new channel for every call. Reusing channels and connections reduces establishment work and lets you take advantage of HTTP/2.
Calls should also have deadlines: an explicit time limit that prevents waiting indefinitely. Cancellation should propagate when an operation is no longer needed.
Retries must be reviewed carefully. Repeating a non-idempotent operation can cause duplicate effects if there is no adequate idempotency mechanism.
5. Streaming: when yes and when no
gRPC supports several patterns:
- One request and one response.
- One request with a stream of responses.
- A stream of requests with one response.
- Bidirectional streaming.
This can be useful for continuous processing, synchronization, or exchanging events between services.
However, long-lived streams complicate resource management, concurrency limits, and failure recovery. You should not use streaming only because it is available; you must check that it fits the business pattern.
6. Compression and cache
Protocol Buffers already offers an efficient binary representation in many cases. Adding compression can shrink size further, but also consume CPU. For small messages, the benefit may be insignificant.
gRPC can use application or service caches, but you should not assume it automatically leverages conventional HTTP cache like a REST GET endpoint. The strategy must be designed explicitly.
7. Interoperability and clients
REST is usually simpler for public APIs and generic web clients. gRPC requires the client to support the protocol. In browsers, gRPC-web and compatible proxies may be needed depending on the architecture.
That does not make gRPC a bad option for the frontend, but it does add considerations around compatibility, client generation, and deployment.
8. How to compare correctly
A useful comparison must perform the same operation and keep data, business logic, infrastructure, and network conditions constant.
Measure:
- Latency p50, p95, and p99.
- Throughput under concurrency.
- CPU and memory.
- Bytes transmitted.
- Serialization and deserialization cost.
- Database and dependency time.
- Errors, deadlines, and retries.
Compare new and reused connections, as well as different message sizes. It is not valid to compare an unoptimized REST API with a carefully tuned gRPC implementation and attribute the entire difference to the protocol.
9. When to choose each one
REST is usually better when:
- The API is public or consumed by diverse clients.
- The resource model fits the domain.
- Interoperability and HTTP cache matter.
- Current volume and performance are sufficient.
gRPC is usually attractive when:
- Communication is mainly between services controlled by the organization.
- You need typed contracts and client generation.
- There is high volume of calls or messages.
- Streaming fits the operation.
- The team can operate and observe the required infrastructure.
They can also coexist: REST at the public boundary and gRPC between internal services. That separation lets you use the right tool for each relationship without forcing the whole platform onto a single model.
Conclusion
gRPC exists to offer a remote communication model with defined contracts, code generation, and streaming. It can be efficient, but it does not eliminate network, query, dependency, or design costs.
REST remains a solid option when simplicity and interoperability weigh more than gRPC’s specific advantages.
Do not migrate because Protocol Buffers seems faster in theory. Migrate when the contract, the communication pattern, or the measurements show that gRPC better solves a concrete need.
In this series
- REST: how to design and optimize an API
- REST vs GraphQL
- gRPC vs REST (this note)
- WebSockets, SSE, and Webhooks
- Cache and compression
- Benchmarks and architecture decisions