JSON over HTTP vs gRPC
JSON text costs CPU to write and read, and it is larger on the wire. gRPC sends compact binary messages. A worker with 0.5 vCPU takes 2,400 calls/s. With JSON, p99 passes 10 s and 35 percent of calls fail. With gRPC, p99 is 25 ms.
HTTP/1.1 · connections: 6 · 30 files in 7 round trips, 630 ms
280 req/s · CPU 70% · mean 22 ms
Case 1
2,400 calls/s reach a worker with 0.5 vCPU. Each call sends 2 KB and gets 12 KB back. p99 must stay below 180 ms and errors below 0.1 percent.
| Measure | Goal | JSON over HTTP/2 | gRPC with compact messages |
|---|---|---|---|
| p99 latency | under 180 ms | 10.1 s Fail | 25 ms Pass |
| Error rate | under 0.1% | 35.3% Fail | 0% Pass |
| Monthly cost | 12 USD/mo | 12 USD/mo |
Case 2
The same worker at 300 calls/s. Both formats give p99 near 25 ms, so the format does not matter at low load.
| Measure | Goal | JSON over HTTP/2 | gRPC with compact messages |
|---|---|---|---|
| p99 latency | under 180 ms | 25 ms Pass | 25 ms Pass |
| Error rate | under 0.1% | 0% Pass | 0% Pass |
| Monthly cost | 12 USD/mo | 12 USD/mo |