How to use cluster processing on a loop?

Ok, I did this example on JSfiddle to emulate (really bad work), my dilemma: https://jsfiddle.net/Dillybob/7zkL097q/2/

In the cluster module for nodejs, I want to use my child workers (processing power) as much as possible to help run my setInterval MonsterLoop faster and faster. In my example above, if I ran this code inside my cluster's isWorker , it would run 6 times per second.

Does this seem inconsistent and looks like it will use more processing power? And since I manipulate this object during the loop, I'm sure that someday another process will hold it, will there be data that becomes undefined? It seems that 6 times per second is simply not the right way, but only once.

So I try differently. Instead, I inserted this loop inside the isMaster block. Thus, it receives only once every second, but uses only 1 core. Is it possible that this cycle was run once, but to seize power from subsidiary processes to make it work faster?

0
cluster-computing
source share

No one has answered this question yet.

See similar questions:

7
NodeJS on multiple processors (PM2, Cluster, Recluster, Naught)

or similar:

2237
How to pass command line arguments to Node.js?
2201
How to decide when to use Node.js?
1835
How to update each dependency in package.json to the latest version?
1648
How to quit Node.js
1517
How to debug Node.js applications?
1388
What is the purpose of Node.js module.exports and how do you use it?
1264
How to get started with Node.js
251
How is Node.js initially faster when it still relies on threads inside?
125
Capture Node JS alternative for multithreading
one
reload node.js workgroups

All Articles