December 16, 2014

Handle HTTP request in multiple processes in NodeJS

NodeJS is single process based which is good at frequent IO operations. But single process can’t fully utilize multi-core CPU. Luckily we have child-process module in NodeJS to spawn multiple processes. One of the practical examples is handling HTTP request, especially for a large number of concurrent requests. A common way is to use master-worker pattern, a master process working as a proxy to delegate the HTTP requests to child processes with load balance enabled. ... Read more