5
1 Comment

Guides for how to scale your web app

Something missing from many online courses out there, and often learnt-on-the-job, is how to scale a web app up to more users – 100K, 1M or even more than 11M. Due to the COVID-19 situation and with school closures forcing kids to stay at home, Khan Academy scaled to 2.5x their web traffic in a week by using serverless architecture and CDN caching of all static data. They also extensively cached common queries, user preferences and session data.

You can also adopt a bottleneck-centric approach to scaling, by checking your resource monitoring to identify the bottlenecks. It is usually the database first. But bottlenecks can be memory, CPU, Network I/O or Disk I/O.

As a principle, make the web stack do less work for the most common requests.

Some ideas:

  • Cache database queries

  • Index the database

  • Move session storage to an in-memory caching tool

  • HTML fragment caching

  • Use queues and more workers

  • Use HTTP caching headers

  • Add a Content Delivery Network in front of a static file host

Here's a guide for scaling up to 11M users, stage by stage:

  • Use vertical scaling early on but it has no failover or redundancy.
  • At >1000: Add availability zones, load balancers, and slave database to RDS.
  • At 10K-100Ks: Horizontal scaling of instances. Move static content to S3 and even some dynamic content to the Cloudfront CDN. Add more read replicas of the database to RDS. Shift session state off your web tier and store session state in ElasticCache or DynamoDB
  • At >500K: Add automation tools and decouple infrastructure. Add monitoring, metrics and logging.
  • At >10M: Use federation, sharding and explore other types of DBs

--
I'm not allowed to share the multiple links to the guides here, but you can find all the links to the original guides in this post.

posted to Icon for group Developers
Developers
on May 17, 2020
  1. 1

    I haven't even needed vertical scaling at 10k-100k users. It's fine on a bottom-tier VPS.

    What kind of app are you running?

Trending on Indie Hackers
AI runs 70% of my distribution. The exact stack. User Avatar 187 comments I'm a solo founder. It took me 9 months and at least 3 stack rewrites to ship my SaaS. User Avatar 150 comments I used $30,983 of AI tokens last month in Claude code on $200/mo plan User Avatar 72 comments my reddit post got 600K+ views. here's exactly what i did User Avatar 40 comments I turned someone’s tweet into an app idea and it has made ~$3000 so far in 4 months. User Avatar 35 comments We could see our AI bill, but not explain it — so I built AiKey User Avatar 27 comments