Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker vs Cluster with Node.js

Tags:

node.js

I was learning Node.js and came across some of the ways to scale an app using Node. So, basically there are two ways: Clusterization and Worker threads. So, I would kindly like to ask a question on scalability of Node.js. So, as far as I understood, clusterization helps to create several instances of node.js app which in turn helps to serve more requests. But the question is Can't we achieve the same with docker?, that is, wrap one instance of Node.js app and create clones out of it and then use load balancer in front of them. Is that possible?

like image 555
ooopp Avatar asked Mar 30 '26 15:03

ooopp


1 Answers

You can do both, but it really depends on how you want to architect your application. If each instance is relatively independent then you can just spin up N containers, each with a Node process. If they're interdependent you may want to use a single container with a forked process manager in it.

Keep in mind that a lot of the clusterization tools are built to solve the same problems that Docker itself does so there will be overlap in functionality here.

like image 192
tadman Avatar answered Apr 02 '26 04:04

tadman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!