Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node cluster versus Dynos scaling

After reading a handful of articles on scaling node apps I have not yet made up my mind about when should I use node builtin cluster or simply adding more dynos.

Let me tell you I have already read the following threads on StackOverflow:

How to properly scale nodejs app on heroku using clusters

Running Node.js App with cluster module is meaningless in Heroku?

As far as I understood it, if I make use of node cluster functionality I will end up with the total memory available divided by the number of forked processes.

On the other hand, if I add one more dyno I will double the memory available.

So, what is the point of using node clusters?

like image 310
utxeee Avatar asked Sep 20 '25 19:09

utxeee


1 Answers

It's not really an either-or situation. You can make use of multiple node cluster instances on multiple dynos. Memory isn't really what you want to look at, though, since that would be a shared resource. CPU / core usage is more relevant to clustering in node, since each node process can only make use of one CPU core at a time.

It's really going to depend on which dynos you are using, too.

Have you seen these suggestions on the official heroku docs yet?

like image 187
dvlsg Avatar answered Sep 22 '25 11:09

dvlsg