DEV Community

Cover image for REST vs gRPC: What I Learned About Choosing How Services Talk
Flovian Atieno
Flovian Atieno

Posted on

REST vs gRPC: What I Learned About Choosing How Services Talk

Last week I attended the Systems Thinking & Design mini-conference at Zone01 Kisumu. Geremi Wanga’s talk on REST vs gRPC reframed a question I used to treat as a popularity contest.

The core difference
REST focuses on resources: nouns with URLs, like /drivers/42, with HTTP verbs carrying the intent.
gRPC focuses on operations: actions you want a service to perform, like finding a driver or placing an order.

REST is an architectural style (described by Roy Fielding in 2000), not a protocol. gRPC is a framework that grew out of Google’s internal Stubby and was open-sourced in 2015. It uses Protocol Buffers and HTTP/2 by default.

What gRPC looks like

You define a contract in a .proto file:


proto
service DriverService {
rpc GetDriver(DriverRequest) returns (DriverResponse);
}

message Driver {
int32 id = 1;
string name = 2;
bool available = 3;
}


Then you generate a typed client and server from it, so your code just calls driver.getDriver(42) and the network does the rest. In the talk’s example, the same message was 41 characters as JSON and 11 bytes as protobuf. Real savings depend on your schema and payload, so benchmark your own traffic.

Three boundaries, three answers

The talk used three scenarios:

  • A public API for thousands of external developers → REST. You can’t assume anything about the callers except HTTP and JSON.
  • An internal payment service talking to an order service → gRPC. You own both ends, the volume is high, and a .proto turns breaking changes into compile errors instead of incidents.
  • Live driver location updates → gRPC streaming. It’s a stream, not a series of questions, and one HTTP/2 connection replaces thousands of polling requests. The ride-hailing design: hybrid by design App → gateway: REST Matching engine → driver service: gRPC Backend → payment providers: REST

The public edge must be reachable by anything. The internal hot path is closed, typed, and owned by you. The third party isn’t yours to redesign.

The price of gRPC

Browsers can’t implement the gRPC HTTP/2 spec directly, so you need gRPC-Web and a proxy.
Debugging needs grpcurl or reflection, since curl and devtools can’t read binary frames.
Load balancers must understand HTTP/2 end to end, because L4 balancing of one long-lived connection goes wrong.
Changing a field number carelessly breaks compatibility you can’t see in a diff.
Codegen and a new toolchain are a real cost for a small team.
The systems thinking connection

The conference’s other sessions covered “fixes that fail”: adding highway lanes causes induced demand, and suppressing every small fire causes mega-fires. Choosing REST or gRPC because it’s trendy is the same trap. The steps that apply are:

Understand the system and where the seams are.

  • Understand the constraints: latency, volume, who calls whom, who owns both ends.
  • Understand the people: who debugs it at 3am, who onboards next quarter.https://dev.to/new
  • Design communication intentionally. The boundary is the decision.

gRPC complements REST knowledge, it doesn’t replace it. The engineers who stand out can argue for either one and explain why.

Top comments (0)