How to apply clustering/spawing child process techniques for Node.js application having bouth IO bound and CPU bound tasks?
<p>I'm working on a IOT project where the Node.js application perform following tasks: <br><br>
1. Reading stream of messages using asynchronous messaging library (IO bound) <br>
2. Sending the messages to web service where machine learning happens based on the messages that were sent by Node.js application (IO bound as only API call is involved) <br> 
3. Receive the pattern generated as a result of machine learning from web service (using REST API) 
4. Compare the pattern against the real-time streaming messages (CPU intensive as complex algorithms are involved for pattern matching). <br>
5. Logging stack traces (IO bound)</p>

<p>A node.js application is going to be developed to have these functionalities as separate tasks running under a single-thread by default. Being the fact that, spawning the child process will be useful only for CPU intensive tasks, how to to do clustering for node.js process doint both IO and CPU bound tasks? Do we need to partially perform clustering on this node.js application?</p>

<p>Can anyone please suggest the effective architecture for this node.js application?</p>