On Saturday, January 3, 2015 1:21:05 PM UTC-5, Peter Frazier wrote:
Good morning|afternoon|evening,
I don't see where you are spawning processes at all in this code. Without that part it is difficult to say what might be going wrong.
Does this code work fine if you do it without spawning processes?
What benefit, exactly, do you hope to get by spawning processes? Are the tasks CPU-intensive, so you're spinning your wheels in JavaScript and not answering new requests?
If every API request sooner or later winds up hitting this code, then there's no real benefit in responding to requests faster than you can actually process them.
Our approach in this situation is to run multiple independent copies of the application, no more than one per core usually, listening on separate ports, and use nginx as a round-robin load balancer, which is very easy to set up and a proven solution.