codequest / system design
Like Uber or Ola in one city

🚕 Ride hailing system design

A simplified, healthy design: 6 app servers behind a load balancer, a cache (50% hit rate), an async write queue, a primary database. At 1,100 requests per second it runs at p95 53 ms with 0.0% errors for about $435/month.

Healthy at 1,100 req/s
p95 latency (server)
53 ms
Error rate
0.0%
Est. cost / month
$435
excl. bandwidth
App servers
400 req/s each · $40/mo
6
Hit rate
DB read replicas
+1,250 reads/s each · also applies every write · $120/mo
0

Primary DB: 1,250 queries/s (1 query per request). How the numbers work

How it works

  • Every active driver sends a location update every few seconds, so most traffic is writes.
  • Location updates go through a queue; the matching service reads the latest positions.
  • At bigger scale you would split the city into regions (sharding). That part is coming to the simulator.
Try this

Push traffic to 2k requests/s. The single primary can no longer keep up with location writes, which is why real systems shard.

Use the Build and Traffic tabs above. The overloaded part turns red and starts dropping requests.

More systems