Questions tagged [node-cluster]

a Node.js module for multi-core network serving.

Cluster is a Node.js module for multi-core network serving.

https://nodejs.org/api/cluster.html

173 questions
1
vote
1 answer

Why does sending a Date Object as a message from a worker thread convert it to a string?

I am trying to run some code across multiple CPUs. Each cpu is given some tasks and then they return the result to the main thread which aggregates everything together. What I don't understand is that whenever I send a message containing a Date…
J. Stott
  • 194
  • 1
  • 16
1
vote
0 answers

Scaling Node.js: Using autoscaling groups with small virtual servers or cluster processes on VM with many vCPUs?

In learning about Node.js's cluster module I've been turning over the following architecture in my head: Balancing costs with performance, would it be more beneficial (i.e. cheapest but still scalable) to run your Node.js application in a cloud…
1
vote
0 answers

Does running different processes in fork mode ensures that the every process is using different core?

I am following this tutorial, and have a question : Will creating different fork processes ensure that every process is being created using different core from vCPU? Or is there we can check that somehow? Experts thoughts on it are highly…
Mehar Singh
  • 45
  • 1
  • 7
1
vote
2 answers

Cron Job running multiple times under cluster environment in Node js

i have set up Node JS server cluster environment to fully utilize all the cores of my server. There is a Cron Job which runs every day 08 O'clock to run some tasks. But due to clustering it runs 4 times(server is of 4 cores) every day at 08…
Abhishek Agarwal
  • 165
  • 1
  • 2
  • 13
1
vote
1 answer

How to set up two workers in Node.js with different intentions?

Traditionally I use: if (cluster.isMaster) { cluster.fork(); cluster.on('exit', function(worker, code, signal) { cluster.fork(); }); } if (cluster.isWorker) { ... } to setup workers but say if I want two servers running at different…
Aero Wang
  • 8,382
  • 14
  • 63
  • 99
1
vote
0 answers

Half of my cluster workers do not read any contents from a file - Node.js

I am having trouble, understanding, why would half of the workers I create are able to read the contents of a file and half of them read nothing. Here is the code I have: // Declare initial stuff const cluster = require('cluster'); const numCPUs =…
1
vote
0 answers

[ Nodejs | Cluster ]: How to wait answer of all my workers?

I have a clustered node app, and I'm looking for a way to get state of all my workers from one request. I use express to ask the masten but it's not express related. with one request, i would like to have something like this: [ { pid:…
Bobu
  • 36
  • 3
1
vote
2 answers

Nodejs cluster assign task only to one worker(Any)

The problem I am facing is that the project has already programmed with cluster to distribute task. if (cluster.isMaster) { // Fork workers. for (var i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on('exit', (worker, code, signal)…
sndpkpr
  • 589
  • 6
  • 16
1
vote
0 answers

Worker stopped sending data to master

I have an app (master) which distributes work to n amount of workers. Inside the worker js I have hooked the console output as follows: console._log = console.log; console._error = console.error; console.log = (...args) => { process.send({ …
0x_Anakin
  • 3,229
  • 5
  • 47
  • 86
1
vote
1 answer

Firebase event listening on multi server clustered node

I am using firebase realtime database on node. I am using node clusters to fork different child processes. For each process, firebase events listener is initialized. But I want to listen to the firebase events only once in my application. Multiple…
1
vote
0 answers

NodeJS Sticky Session for Users sharing same IP Address

Our NodeJS (With Sockets and HTTP) project is being used by users (all are working from same office, same network) sharing a same public IP Address. I have put a sticky session implementation which generates an hash based on Public IP Address of the…
Royal Pinto
  • 2,869
  • 8
  • 27
  • 39
1
vote
1 answer

Node Cluster and/or Docker Cluster?

Trying to get the best performance from my application with as little setup as possible. I'm struggling to find a consensus online of whether it would be better to use the Node cluster module in a Docker container, or to use a cluster of Docker…
hoodsy
  • 894
  • 2
  • 11
  • 19
1
vote
1 answer

Node.js cluster error

Hello i am very new to node.js and javascript, i am trying to create a culster.js with the nodejs cluster module, at the end of my if statement i am calling server.js to start the app. cluster.js const cluster = require('cluster'); const cpuCount =…
Momo
  • 61
  • 12
1
vote
0 answers

Firebase with clusters

I am using Node.js with Firebase. I want to use all the cpu-cores, by using cluster-module. Do these two work together? As I have binded firebase nodes with event listeners and Firebase maintains socket between NodeJs and firebase. How can I use all…
1
vote
3 answers

Run two tasks in two different workers using cluster in nodejs

I am learning clustering in NodeJS. I have two tasks one is node-sass and another one is uglifyjs which I want to run by two different workers using cluster in nodeJS. Though the code is working file and creating the SASS -> CSS file and main.js to…
Nesh
  • 2,389
  • 7
  • 33
  • 54