Scaling

How do I scale a web app?

Scale in this order — measure first, then fix the real bottleneck:

  1. Measure: monitoring, error tracking and slow-query logs
  2. Cache & CDN: serve static files from a CDN; cache expensive results (Redis)
  3. Fix the database: indexes, efficient queries, connection pooling
  4. Go stateless & horizontal: run several app servers behind a load balancer (or serverless that autoscales)
  5. Move slow work to queues: emails, reports and imports run in the background
  6. Read replicas: send read-heavy traffic to database copies
  7. Split services last: only the parts that genuinely need independent scaling

Why this order: the cheapest fixes (caching, indexes) usually give the biggest wins.

All guides