← Architecture Lab

Route Computation at 25% of the Bill

Every fare estimate was a paid API call. Cutting the bill by 75% meant asking a cheaper question, asking it less often, and still answering when the provider didn't.

estimate farebilled callRider AppScheduled RidesRouting ServiceRedis (dedup)Primary ProviderDistance Matrix

Rider App → Routing Service → Provider

Cost that scaled with usage

Every fare estimate, every route preview, every scheduled-ride recalculation resolved to a billed third-party call. That's fine at low volume and structurally bad at high volume: the cost line tracks usage exactly, so growth and spend rise together. Nothing was broken — the bill was simply a function nobody had tried to change the shape of.

Why not the alternatives?

Cache aggressively with a long TTL
Route results decay — traffic, closures, and conditions change what the right answer is. A long TTL trades a cost problem for a correctness problem, and a stale ETA erodes trust faster than the saving is worth.
Self-host a routing engine
Removes the per-call bill entirely and replaces it with map data ingestion, update pipelines, and infrastructure to operate. That's a reasonable trade for a company whose product is routing; it wasn't one for a team whose product is mobility.
Rate-limit or throttle estimates
Makes the bill a user's problem. Someone comparing two pickup points is doing exactly what the product wants — the fix belongs behind the interface, not in front of it.
Switch providers without a fallback
The saving would have been the same and the availability worse. A single cheaper dependency is a cheaper single point of failure, not an improvement.

Lessons

  • Compounding beats optimising: removing calls and repricing calls multiply, and neither alone came close to the total.
  • The cheapest request is the one not made — deduplication is a correctness-neutral saving, which makes it the first place to look, not the last.
  • A fallback is a cost strategy, not just a reliability one: paying a premium on the small fraction of requests that need it is what makes a cheap primary safe to adopt.
  • Abstracting the provider was the enabling move. Everything after it — switching, falling through, comparing — was only possible because no caller knew which provider answered.