Recently, I have been exploring the concept, How the PM2 works in cluster mode. assume that, that we have four instances that are running in the cluster mode. and consider instance ids are 13, 14, 15, 16
By default PM2 uses the node cluster module…
Recently I've been researching about Node.js core architecture, but still I don't understand some concepts.
So assume that I have 6 core CPU and it's an Intel CPU, so actually I have 12 logical processors for threads for any execution in my computer…
I'm tryng to make a server with muitiple workers, but the server never starts when I use the import statment. If i put the code directly inside the worker function they run with no problems.
code with import:
import os from 'os'
import cluster from…
I am currently trying to find a way to end all worker threads spawned from some master thread after any of them finishes. I've looked at various schemes for communication between worker threads (e.g. cluster.worker.send(), process.send(), etc.), but…
Currently I'm doing a nodejs project where I don't want to use any third party packages or database systems. Now I'm almost done with the project. But here's the problem. I've some authentication related functionality that needs "Sticky Load…
I am running node js and using cluster module. In child process I am creating a websocket server and on websocket connection I am doing console.log(process.pid) on each websocket connection. I even added a loop in worker thread to slow it down which…
I am working on a chat app where the master node is receiving request through tcp socket and after analyzing if its normal http request or web socket it is passing the socket to worker node. I see that when the socket is not read(i.e the…
In my master node, a tcp socket is intercepting all requests, where I want to separate normal http requests and websocket ones. I need the wobsocket connections to be handled by a particular node in a time (say worker 5 handles all connections until…
I have an application which uses NodeJs Cluster module to fork multiple processes of the app, each of these process send out post request to an endpoint which i want to nock.
Now i understand that nock works by overwriting the nodes process…
Im experimenting abit with Socket.io and Socket.Io-redis.
I have my Redis server up and running.
The error i get when starting the Socket.Io server is:
ReplyError: ERR unknown command 'pubsub'
I dont know why i get this error at all.
The Redis…
My node.js app currently subscribes to a number of websocket servers that is starting to push a lot of data over to the app every second. This websocket client app has several event handlers that does some work upon receiving the websocket…
Why dose the program print "Hello World" 2 times rather than only 1 time? The console.log is excuted before cluster.fork().
import * as cluster from "cluster";
console.log("Hello World");
if (cluster.isMaster) {
const worker = cluster.fork();
…
Is it a good way to create a high loaded server on node.js?
I need to start the high loaded (1-3k requests) http server to handle Post requests. As a backend i chosen node.js with express.
I have created one shared http server for all forked…
In node cluster docs there are few events that is called by cluster. Out of which 'online' and 'listening' is two events that I am confused about which is being called first.
there is a line written
The difference between 'fork' and 'online' is…
I recently implemented Node cluster as a way to vertically scale my application. Since it uses multiple threads now I naturally added stress tests to the application and that revealed an issue with my application.
So for the sake of this question I…