I new to Node.js and I am sorry for what seems like a noob question but I would really feel better with your advice.
I think I grasped most of the basics of Node.js. I understand that it is single threaded and therefore that all of the I/O jobs are asynchronous in order not to block the event loop.
I also understand that because of this single-threaded nature, Node.js is not very well suited for CPU intensive tasks which would block the event loop.
My question is simple: I'm working on a websocket application and on most of the requests, I have to perform a loop with some computation. According to my tests, this loop may take from 30 to 80 ms to complete. Should I consider this as a CPU intensive task? (if yes, I guess I should then try to delegate it to a child process or split the computation in several parts with process.nextTick).
It really depends on what kind of QOS that you are looking for. I'd say that for a personnal projet this is fine. If you are using websockets for a game for example this might be killer.
The module cluster could be used to get around this. This is more work but that module makes is as easy as possible to get a cluster of process and the communication between them.