How to Scale a Web Application Without Kubernetes
Alin Climente
Posted on September 19, 2024
Many folks add Kubernetes into their stack from the start so they can scale instantly when users flood their web application. Trust me, if the app is a paid app, you will be able to predict the number of users and scale with ease. You just need to know how to set up a virtual machine from any reputable hosting provider, which is super easy:
- Choose a VM with the resources you need (RAM, CPU, Storage).
- Choose Ubuntu as the OS.
- Configure SSH keys.
- Configure GitHub SSH on the VM (so you can copy the code).
It's the same setup as on your laptop.
Single VM
When starting out, if data is not critical, you can just use a simple virtual machine with your web app dockerized and Caddy as a proxy to handle incoming requests. You can scale vertically by adding more resources to the VM. You can go up to 448 GB RAM, 32 vCPUs, and 6 TB SSD. You can even order a bare metal instance with insane resources.
Single VM with Separate VM for Database
If data is important, you can add another VM which will hold just the database.
Single VM with Managed DB and Storage
If data is critical, I would suggest unburdening yourself of the responsibility of keeping the data safe, doing backups, and so on. Using a managed database and separate storage will allow you to focus just on your app. This is my favorite!
Multiple VMs with Managed DB and Storage
If you get to this point, congratulations! Now you can buy a private jet and go to dinner with Elon (if not, add a paywall to your app). You can add multiple VMs to handle the incoming requests and keep the managed DB/Storage for peace of mind (if data is super important).
Multiple VMs with Self-Managed DB and Storage
Probably the managed DB/Storage got way too expensive and you want to cut some costs. You can spin up some VMs for the database. Keep unrelated data on separate DBs.
Now You Probably Need to Learn Kubernetes
Manually deploying doesn't cut it anymore. It is time to add Kubernetes to your stack and properly set up CI/CDs.
Why Not Cloud Functions/Lambda?
I would rather have a few hours of downtime than go homeless from a mistake or a random bot DDoS. Yeah, but you can prevent it! Sure, but is it worth the risk though?
Keep it simple, folks.
Posted on September 19, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024
November 30, 2024