⌘ K◐

Use protobuf for internal RPC

decisions·updated 7mo ago·accepted#infra#perf

Context

order-routing-v2 needs single-digit-ms internal serialization to hit a <200ms p95. Current stack is JSON over HTTP for everything, including service-to-service. Live preview in rules-engine-customer-ui also needs an 80ms RPC budget.

Decision

Move internal RPC to protobuf over gRPC. JSON remains at the edge (customer-facing APIs, webhooks) — no public-API breakage.

Why

  • Driven by order-routing-v2 needing single-digit-ms internal serialization.
  • Schema-first is easier to evolve than ad-hoc JSON; we've had two recent prod incidents from silent JSON shape drift.
  • Devon's team has prior gRPC experience. No greenfield risk.

Consequences

  • New pbgen step in CI; one-time investment.
  • Existing internal endpoints migrate over Q2-Q3; no big-bang.
  • Edge stays JSON; customers see no change.
  • Audit log (audit-log-v2) sits on the same RPC bus — single migration, two beneficiaries.