In node.js slow readable stream attached to a faster pushing message queue eats up memory

Posted by Vishal on Stack Overflow See other posts from Stack Overflow or by Vishal
Published on 2013-07-01T23:03:03Z Indexed on 2013/07/01 23:05 UTC
Read the original article Hit count: 177

Filed under:
|

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
});

© Stack Overflow or respective owner

Related posts about node.js

Related posts about stream