NodeJS | Cluster Blocking processes. Send and worker.send? If so, what is the performance?

I have 2 questions.

  • Are the functions process.send and worker.send blocked? And what is the performance of this type of interprocess communication?

  • I have a cluster that has a wizard that pushes updates for the worker and workers by clicking the aggregated data on the wizard. However, there is a specific request when I need the latest data from the wizard. When the request comes to the worker, I save the “response” object, then I do process.send () to contact the master for the most recent data, and then on the main one, I get the data, and then I execute the worker. Send () to send data. I pass the answer back and forth, so that when the request finally comes back, I know which answer to write back, and then call the end () function on it.

Is there a better way to make synchronous calls like this between processes? This does not happen very often, but what performance implications will arise from all the other non-blocking requests that occur? Will he hold the rest? Is this the most efficient way to do this?

+4
source share
1 answer

Are the functions process.send and worker.send blocked

Not.

And what is the performance of this type of interprocess communication

Basically the same as JSON serialization / deserialization. Data transfer is processed by the OS and is pretty fast.

Is there a better way to make synchronous calls like this between processes?

Not in node.

This does not happen very often, but what performance implications will arise due to all other non-blocking requests that occur

It does not matter. This is similar to a database query ... while the database is on and doing its job, the web process may respond to other queries. Here is the main one (master → worker).

0
source

Source: https://habr.com/ru/post/1416082/


All Articles