This week, the nodejs community had a big flame.
All was started by this blog post, which tried to slap down node.js server because of its mono-thread nature. And node.js fight back knocking down the attacker. Let’see how.
Node.js is great for managing a lot of connection. Someone complains about node mono-thread nature.
For cpu-bound tasks,you should relay on a stacked architecture, and considering some form of batch processing if you plan to take too much time to reply to user. No professional website must reply in less then a couple of second to a user. Computing huge fibonacci numbers is not in a typical request-response cycle.
Facebook will not let you export your data in real-time (ok, they will not like export your data anyway, but they have a batch processor for that :).
On some node.js tutorials, cpu-intensive task are demanded to a second pool of web servers, possibly always written in node, with a REST-interface.
But the real answer is still another.
There is a node.js module called “cluster” which is able to fire a bunch of node.js server and manage them. Ryan Dahl (node’s father) has already said he is working hard to push “cluster” inside node.js core. So it is likely the mono-thread nature of node will not be an issue anymore.
Ryan replied in this blog post also.
Punch back!
This flame remember me the “no MMS on iPhone” debate. A lot of guys complain when the first iPhone-s was unable to send Multi Media SMS. After a short period, Apple released a software update to fix it. It was never a real issue!
Node.js will not a cpu-bound ideal server, because it use javascript as primary language. It is like pretending python must win native-thread-spawning-war against Java: it is impossible, but you can write an XML RPC server in python in less then ten lines of code, a thing Java will not ever be able to do!
On the same side, perl will beat your C code when you try to parse a text with regular expressions: because perl engine has far more experience then a “normal super-geek C programmer”. Even if you use all your knowledge, perl will match the speed of a C regexp parser.
(Ok, perl will also beat C for an obfuscated contest code, but this is another story).
And lastly, Java will not win the concise code-contest. It will come last, or little before ADA is ADA is admitted to the contest :) …and yes is friday today… be happy!