In node.js slow readable stream attached to a faster pushing message queue eats up memory
- by Vishal
In my node.js program I have a response stream attached to a message queue (zeromq) delivering data at a very high rate. Due to slow network connection the response stream and its underlying implementation is unable to consume data at that pace thus occupying a lot of memory. Do you have any suggestion to solve this problem.
For reference please see the code snippet below:
zmq.on("message", function(data) {
res.write(data);
// End response on some event
});