DEV Community

Discussion on: How do you scale a nodejs real-time API to concurrently serve a million users?

Collapse
 
dmfay profile image
Dian Fay

Articles about scaling Node are going to recommend pm2 and load balancing because that's how you scale Node. There are plenty of articles here & elsewhere about containerization if you look for those instead; the important thing to remember is that once you have a container that's listening on whatever port and serving content, the fact that it's doing that with Node stops mattering. Same goes for CI/CD and database tuning: the content is out there, and easily found with a little exploration.

Anyway, from 30,000 feet the approach I'd take is to build Docker images as part of CI, deploy them to DockerHub or a private registry, and manage them with Kubernetes, since that's more or less become the default orchestration tool. You'd want to look into high-availability Kubernetes specifically since that involves some extra configuration to avoid single points of failure.

Collapse
 
presto412 profile image
Priyansh Jain

So container management with kubernetes will avoid single points of failure, and this I'll have to integrate with my load balancer and process manager right?
On a side note, are there any good methods to identify the ideal amount of RAM and processing power i should deploy with my servers, to optimise costs? Are there any metrics?