Is it possible to limit bandwidth for a certain node.js process? It appears that pause
/resume
on socket data doesn't actually affect the download speed.
I've also tried trickle to no avail: trickle -d 1 -u 1 node band.js
, shows the same speed as without trickle.
I have the same problem on this. I posted a issue on github project libuv, it's the core of event system of Node.js, since I believe that's the cause why trickle does not work. (https://github.com/joyent/libuv/issues/844)
Thanks to response from bnoordhuis, the reason trickle can't work is because of libuv use system_call to use system call directly, not by calling glibc. However, trickle only wrap glibc functions to add bandwidth limitation support.
I haven't found a perfect solution yet, but you can try these: