1How would you scale a web application from 1,000 to 1 million users?
Go step by step, saying what bottleneck each step solves:
- One server with the app and database. Fine for thousands of users.
- Separate the database onto its own machine; add indexes and fix slow queries.
- Stateless app servers behind a load balancer: sessions in Redis or tokens, uploads in object storage, so you can add servers freely.
- Caching: Redis for hot reads, a CDN for static assets and cacheable pages.
- Database read replicas for read-heavy traffic; connection pooling.
- Asynchronous work through queues and workers (emails, reports, image processing).
- Sharding or splitting databases by domain when writes outgrow one primary.
- Split services where teams or scaling needs diverge; add monitoring, autoscaling and multi-zone redundancy throughout.
The key message: scale based on measured bottlenecks, not up front.