I recently became aware of Node.js and I'm trying to sort out where Node.js fits in the server side development picture. I found a few introductory videos from Ryan Dahl which sort of gave me the impression that Node might be the way of the future. So naturally the first thing I did from there was to Google "Node.js sucks". And of course, like anything that anyone thinks is good, somebody has to explain why that first guy was totally wrong. Whenever I hear the type of argument where one side says "X is the best possible," while the other side says "X is the worst possible," I always assume that X is very specialized – it's very good at doing something that people who like it need to do, but others don't. What I'm trying to put my finger on is just what exactly does Node.js specialize in?
Most server-side developers are very used to running basically linear processes concurrently in separate threads. This method allows you to run multiple complicated processes at the same time, and if one process fails, the other threads can still remain intact. So having a single thread run one process at a time sounds like it would be really slow. I don't think this is the case with Node.js because it is asynchronous and event based, which is a very different model than one might be used to.
Instead of running one process, waiting for the client to respond and then starting another process, Node.js runs the processes it has the data to run as soon as possible in the order it receives them. Then when the response comes back that's a new process in the queue, and the application just keeps juggling these requests. The overall design is such that Node developers are forced to keep each process very short because – as the detractors are quick to point out – if any one process takes too long it will block the server's CPU which will in effect block the application.
So you can't do long complicated processes like calculating pi with Node.js. Apparently they have workarounds for spinning off really complicated processes if you really need to, but that seems to be outside of the scope of the original plan. I think that where Node shines is in routing a high volume of low-overhead requests. Which means to me that Node.js is great for light messaging applications with a high user volume.
Are there other uses I've missed? Are there other issues with asynchronous programming in a single thread? Is there some part of the big picture I'm not seeing? Am I just plain wrong about all of this? Leave me a comment and let me know what's what.