← Lessons

quiz vs the machine

Platinum1800

System Design

Surge Pricing Computation

Computing a per area price multiplier from local supply and demand in near real time.

6 min read · advanced · beat Platinum to climb

Why prices vary by place

When many riders want trips in an area but few drivers are available, wait times balloon. Surge pricing raises a multiplier in that area to damp demand and pull more drivers in, restoring balance. The computation is fundamentally local, tied to a geographic cell, not a global number.

The pipeline

  • Aggregate per cell. Count open requests and available drivers within each geo cell over a short window.
  • Compute a ratio. A demand to supply imbalance maps through a curve to a multiplier.
  • Smooth it. Apply hysteresis and caps so the price does not flicker wildly between updates.

Serving and trust

  • Multipliers are published per cell and looked up at quote time by the rider location.
  • Changes are rate limited and bounded so the experience stays predictable.
  • The quote shown is locked for a short time so a rider is not surprised mid request.

Key idea

Surge pricing aggregates demand and supply per geographic cell into a smoothed multiplier that nudges the local market back toward balance.

Check yourself

Answer to earn rating on the learn ladder.

1. What drives the surge multiplier in an area?

2. Why apply smoothing and caps to the multiplier?