F
F
ff0xff2018-08-15 07:20:51
Node.js
ff0xff, 2018-08-15 07:20:51

Running multiple processes on nodejs?

Good afternoon, dear friends, I have a task of some kind of load testing.
Testing is carried out by running a script (for example, test.js)
The launch process is quite simple, we run test.js in a loop so that it runs in several threads.
I am interested in the question, how to maximize the load on the CPU of a machine that performs testing?
Let me explain:
Testing is carried out in several threads, the formation of these threads occurs in a cycle .
If it is simpler, a separate instance of the test.js application is launched on each iteration of the cycle.
Everything is very primitive here. It works but one moment does not suit me.
CPU resources are not spent efficiently, at the time of launching one instance of the application, it eats up almost the entire CPU
And then its consumption drops .... I tried to run on a timeout with a certain delay, this gave a more uniform CPU load
Dear nodejs experts, maybe someone knows the most efficient solution to such a problem?
I would like the CPU to be loaded to the maximum - but not overloaded with tasks.
I was thinking about another solution for the test instance launch algorithm.
For example, determine the current CPU load in% and start a new instance or wait until the load subsides.

How would you solve this problem?
What libraries/methods/approaches are there to solve this problem at the moment?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rostislav, 2018-08-19
Makkall @viogull

There is a standard "cluster" module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question