2 ms·
This is a real problem, if you're from the school that believes that processes can crash. But it is also an issue if you believe it is possible to overload a s
by nirvana 15y ago
This is a real problem, if you're from the school that believes that processes can crash. But it is also an issue if you believe it is possible to overload a single process on a machine where multiple processes could better handle the load. Nodejs runs a single v8 instance on a machine, or if you're running multiple ones in parallel they don't really cooperate as they aren't really aware of each other. So, if one gets behind its hard for the others to take up the slack.
Here's a concurrent answer to this problem, that a future nodejs version might consider adopting (and is the basis of the nirvana web platform I'm building):
Distribute requests across a series of javascript virtual machines running on a collection of compute nodes. Multiple vm processes per node, and multiple nodes per cluster.
Thus, if any one V8 process dies for whatever reason, you don't lose many requests.
In fact, I believe losing even one request due to the crashing of a V8 process, would be considered a bug.
My solution to this involves using erlang at a fundamental level to distribute load, and passing the requests off to various instances of a Javascript Virtual Machines to handle the requests. The web developer writes their application in coffeescript or javascript, and the platform takes care of distribution, concurrency, etc.
The downside of this, of course, is that given that js isn't a really concurrent language, there is a bit of an impedance mismatch... but I find that this is equal to or less than the hassle of dealing with event driven code in the first place.
If you're interested in my solution, we should hit alpha soon after Riak (the underlying platform) hits 1.0 later this month. Follow me on twitter for updates @nirvanacore (that twitter account only talks about the web platform, no noise.)