What is the performance of a pipeline pipeline in node.js?

I have a TCP server written in Node.js. When a socket is received on its server socket, the process moves from the socket to the process pool. It either develops or reuses a previously forked process. Then it passes the received socket to another process using ChildProcess.send (). This gives full control over the socket of the child process.

I am considering a different approach, but I am concerned about potential trade-offs between manufacturers. Instead, I would like to connect the socket to the child process, either via stdin, or into a unix-domain socket, or possibly into a pipe. There are a number of reasons why this approach would be preferable in my particular area, but I will not discuss this issue with these details.

Therefore, it remains for me to wonder about the performance characteristics of the pipe () method in the Node.js. Is the pipeline of the stream processed at the system level, or should Node.js read every byte from one stream and send it to the destination? There are several system calls (i.e. Splice ()) that provide some level of streaming of file descriptors with zero copy. Does Node.js use some kind of mechanism like this or is it manual?

+5
source share
1 answer

I recommend reading this blog post that highlights how

when it comes to threads, everything happens as fast as the slowest threads in a workflow

Also, read this answer that explains how to test threads in node.

0
source

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


All Articles