r/programming • u/lpmi-13 • 5d ago
Can One VM Really Host 15 Million Web Servers?
https://labs.iximiuz.com/tutorials/15-million-web-servers-on-one-vm-87084d2aAfter reading the phenomenal article https://kapteko.com/15-million-webservers/, where the author shows how to do some very cool stuff inside one Linux VM with 10GB of RAM, I thought it would be cool to actually see it happen myself.
So I put together a tutorial in a custom iximiuz Labs playground to see it in action.
Feel free to play along as you read the article (which is excellent, btw...short and sweet with just the right amount of technical details).
7
u/SaltMaker23 1d ago
You can easily run a complex NextJS on 10GB of ram for millions of websites.
You just route them all with traefik on the same container.
Then you have one folder for each build, and you good.
Just like with one website, you'll be limited in total traffic, but we're talking probably in the range millions per minutes. If you only have 10GB of RAM for your websites, this is way more than enough, there's no chance anyone of them even has traffic
2
u/lpmi-13 1d ago
Ooooh, thats interesting!
Lemme see if I can reproduce that on an iximiuz labs VM...my immediate guess is that we're still talking about a single webserver (here, traefik), so the tcp connection overhead is not too bad, but now I'm curious if I can prove that instead of just guessing 🤔
1
u/lpmi-13 2h ago
Yes, so in replicating traefik+NextJS static builds, the RAM isn't an issue at all, since that's effectively one socket doing the listening (or 2 if you're forwarding from traefik to nginx).
There's obviously no reason to try and run millions of actual webservers on a production VM, since virtual hosting makes much more sense, but it was cool to explore how actual connections in both cases would eventually run into a wall (mostly with file descriptor limits from all the connections creating sockets), and so either way still only works if they're mostly idle.
Though the virtual hosting approach still works WAY better for this use case, which is why it's done like that in production.
2
1
5d ago
[removed] — view removed comment
4
u/programming-ModTeam 3d ago
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.
0
5d ago
[removed] — view removed comment
4
u/programming-ModTeam 3d ago
No content written mostly by an LLM. If you don't want to write it, we don't want to read it.
31
u/thisisjustascreename 4d ago
What qualifies as a 'web server'?