DeliveringOrder #981
To Home · Indiranagar, BLR-07
Sharing location0 MB this hour
DeliveringOrder #981
To Home · Indiranagar, BLR-07
Sharing location0 MB this hour
DeliveringOrder #981
To Home · Indiranagar, BLR-07
Sharing location0 MB this hour
Ravi’s rider app sends his location every second, so the customer can watch him on the map: a REST request for each update, or one gRPC stream that stays open. Then a new order comes, and half the riders haven’t updated their app. Illustrative sizes.
REST for public APIs and browsers: simple, readable, supported everywhere. gRPC between services, and for apps that stream: smaller messages, both directions on one connection, and a contract that keeps old app versions working. Many companies use both.
| Difference | REST | gRPC |
|---|---|---|
| Each location update | A new request: headers + JSON, ~793 B | A message on an open stream, ~40 B |
| Data per hour (1 update/s) | ~2.9 MB | ~0.14 MB |
| Server → app | Can’t; the app polls | The same stream, both ways |
| Old app versions | Each JSON shape handled by hand | Field numbers keep them working |
| Contract | Docs (OpenAPI if you add it) | .proto; code generated for every app and service |
| From a browser | Works natively | Needs gRPC-Web and a proxy |
| Best for | Public APIs, browsers, partners | Services, and apps that stream |
Ravi is bringing a Zepto order, and his rider app sends his location every second, so the customer can watch him on the map. On the left, the app uses REST: a separate request for every update. On the right, gRPC: one stream that stays open. Let’s put both through three situations.
First, the location itself. With REST, every second the app sends a new request: headers and JSON, about eight hundred bytes with the reply. On a weak signal the requests queue up, and Ravi jumps across the customer’s map.
With gRPC, the app opens one stream and keeps it. Each update is a tiny binary message, about forty bytes, so Ravi glides along the map, and his phone uses a twentieth of the data.
Next, a new order is ready for Ravi. REST can’t call his phone, so the app keeps asking: any new order? Every five seconds. Most answers are no, and the order can wait five seconds to reach him.
With gRPC, the stream goes both ways. The server sends the order down the same stream the moment it’s assigned, and Ravi sees it at once.
Finally, a new app version renames the location fields, but half the riders haven’t updated. With REST, the server gets two kinds of JSON, and any rider it doesn’t handle by hand freezes on the map.
With gRPC, fields travel as numbers from a shared contract. A renamed field keeps its number, so old and new apps both keep working.
So which should you pick? REST for public APIs and browsers: simple, readable, and supported everywhere. gRPC between services, and for apps that stream: smaller messages, both directions on one connection, and a contract that keeps old versions working. Many companies use both.