NodeJS: To V8 or not to V8

February 6, 2011

I have been saying for a while that server-side Javascript matters. We, at Yahoo!, see a bright future in server-side Javascript and are making a big investment in it. But if you follow me on twitter, you’ll know that I am also looking into ensuring high-availability of server-side Javascript-based services on production. Which really comes down to something like: to V8 or not to V8.

If you have not watched Douglas Crockford’s video lecture on server-side Javascript, I recommend you do that first before reading further into this post.

Update: Jason Hoffman (Chief Scientist, Founder of Joyent) has written a very good response to this post. Obviously I owe him some responses, which is on a separate post.

NodeJS is currently tightly coupled to Google's V8 engine. 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.

More to the point, it's really up to Google to work with the community to make V8 work on the server-side. Sometimes Google is responsive, but sometimes it might not. It varies as it depends how fixing a bug or applying a patch may align with Google's product roadmap and plans. I don't know Google's plans, and I suspect most NodeJS committers don't know either.

Maybe for some folks this might not seem like a big problem. And probably, if you are running a site with a few thousand daily page views, it might actually not be a big deal. But to Yahoo!, and to others, it's a big deal and we believe this is fundamental to the success of the NodeJS project.

Writing a Javascript runtime that does not fail is hard. Even the really smart V8 folks have explicitly designed V8 for failures to happen and safeguard the browser. In a browser, a JS engine failure is an inconvenience to the user: damn, you lost a tab. In a thread-per-request blocking I/O server design it's also not a big deal, you lose one in-flight request. But in an event-driven web server, it's a major flaw, you lose thousands of in-flight requests you have already accepted.

For NodeJS to scale to billions of page views like Yahoo!'s, we need to make sure the Javascript engine / VM behind Node is rock-solid for server-side loads, i.e. it fails extremely rarely.

Google may invest on supporting V8 on the server-side, just like the Mozilla folks do. Or somebody else might invest and ensure V8 is rock-solid on the server and Google may merge the patches nicely. Or maybe not, and the community may need to fork V8. Or something else ... Nobody really knows.

Either way, it's time for the NodeJS community to realise there is a roadblock and discuss it openly.


blog comments powered by Disqus