NodeJS: To V8 or not to V8
olympum.com
olympum.com
Bruno: "V8 was not designed as a server-side engine, but as a browser-based engine. Furthermore, V8 was designed squarely to run in Chrome’s multi-process model. As much as I think V8 is a brilliant piece of engineering, it’s software that was not designed to run on a server."
Jason: "I don’t know what this means, or if there’s a difference. More details here would be helpful."
Bruno: "The discussion is not really whether I have technical production problems or not with V8 (within NodeJS); all software has bugs. My issue is about project governance. ... It’s not whether Google’s V8 project is open or not, it’s that since governance of V8 may become a problem in the future, it requires a solution now so that large organisations can put their full weight behind NodeJS."
No idea what sort of patch Bruno is looking for and I don't think Bruno knows either. He's sure not articulating his concern very well.
He also acknowledged that Google is obviously building V8 for Chrome and not Node and shouldn't be expected to spend time and money on features that aren't beneficial to Chrome. One example of this is the time required to spawn a new V8 context, around 30ms. It could be made drastically faster if all security features were removed from the V8 boot process (not needed for server side trusted execution environments) but Google needs secure VMs for Chrome tabs and it wouldn't make sense for Chrome to spend time optimizing V8 for this use case.
I didn't get the feeling, however, as this article implies, that V8 is a "roadblock" for Node.
Yes, you can spawn a context faster if you strip out the duplication and make Contexts share built-in objects. But then you remove the only important feature Contexts have --- isolation and you don't really need them.
[Another important thing here: in the browser each iframe has a different Context. You can't really abandon isolation --- that would lead to spec violation and massive security holes]
If somebody is experiencing problems with GC then they should stop by and ask or file an issue or submit a benchmark/testcase...
V8 is a great technical achievement, but sometimes I wonder if its reputation as "the fast JS runtime" isn't more due to Google's excellent Chrome marketing (remember the Scott McCloud comic?) than actual measurements. JavaScriptCore is no slouch either, and is easy to integrate into applications with its plain-C API.
I think the hoopla over Node.js using v8 or if it shouldn't has died down and for good reason.
But if that happens, Google isn't the only company in the world with the knowledge and ability to maintain V8. Joyent does as well.
But let's assume something even more unlikely: Google, Joyent and the rest of the world drop V8. nodejs is an open-source project.
You might as well worry about being hit by lightning.
Even if Google did abandon it, there are plenty of people interested in it, and want to keep it running. Joyent said themselves that if needed they will fork v8 to keep it sane and right for Node.js.
Bruno: "Node is doomed as V8 was not designed as a server-side engine. We must panic now"
Jason: "There is no need to panic now. Once we finish Node v1 we will start modifying V8 to make Node more awesome. We are not scared to fork if need be"
erlang_js is a competing javascript VM (embeds spidermonkey)
And I'm working on a new web platform based on Riak that allows the developer to write their apps in coffeescript and I use erlang (and parts of riak) to distribute the load around a cluster of machines each of which is running multiple javascript virtual machines. (But this is not yet released... follow @nirvanacore on twitter if you wish to keep up to date.)
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.)