How to scale a web application to serve millions of users
You don’t need serverless, microservices, containers, Kubernetes and what not for 90% of web applications. Even those serving 100,000+users per day or millions of users in a year.
There are many things you can do to achieve high performance and throughputs. Some of those are:
Optimize your Application Code to minimize DB queries as much as possible. If you don’t need a make a DB call, don’t.
Add indexes to your Database tables carefully. There is a balance here and overdoing will also not help.
Introduce Caching :
Cache at edge (cloudflare etc).
Cache at Webserver level (nginx/caddy etc).
Finally cache at Application level. For queries that are more common but don’t change often. Use things like Redis or in memory databases for caching data
Use Queues for long running tasks or background jobs (e.g. running a long report, sending emails etc)
Use Read replica for read only queries for database for applications that are very read and write intensive both. This way, you reduce the load on single instance especially the one that is being written on and for read queries, you use a separate instance.
Scale horizontally (multiple app servers). With AWS, you can use Auto Scaling EC2s for example.
If you do all of the above correctly and optimize smartly, you will never need all the other fluff like micro-services, Kubernetes, containers, serverless and all the other stuff that is usually thrown around when it comes to creating high performance web applications. Most of us are never going to be at Google or Facebook levels of users.