This article is more than 1 year old

The Node Ahead: JavaScript leaps from browser into future

Google V8 engine spawns server world doppelgänger

Would you like to touch my V8?

Ryan Dahl set out to build his JavaScript platform atop Mozilla's SpiderMonkey, the engine at the heart of Firefox. But after about two days, he switched to Google's V8, and that's where he stayed. "V8 is just a nice, clean library," Dahl says. "It's compact and extracted away from Chrome. It's distributed as its own package, and it's easy to build and it's got a nice header file with nice documentation. It's kind of constrained. It doesn't have dependancies on other things. It seemed much more modern than the Mozilla stuff."

Google isn't officially involved in the project, but according to Dahl and other Node developers, the company has been helpful when the project requires V8 bug-fixes or additional insight. "It's an exciting project. I was at the jsconf.eu conference in Berlin last year, and there was a lot of buzz around Node," Google V8 team member Erik Corry tells The Reg. "It's a very cool use of V8 and shows what you can do when you combine open source software in new ways, not necessarily anticipated by the original authors."

Originally, Dahl called his project web.js. It was merely a webserver, an alternative to Apache and other "blocking" servers. But the project soon grew beyond his initial webserver library, expanding into a framework that could be used to build, well, almost anything. So he rechristened it node.js.

He released an early incarnation of the platform in June 2009, but few noticed until he gave a demo at that year's jsconf. His 45-minute talk was met with a standing ovation, and the project was off and running, not just among application developers but at big-name cloud outfits as well.

The demo

"[Ryan Dahl] was certainly ahead of the game in understanding the implications of [the real-time] world," says Alexis Richardson, senior director at VMware and the former CEO of Rabbit Technologies, the outfit behind RabbitMQ, who was reading Dahl's blog before Node was released. "When he introduced Node, I was extremely impressed."

A month later, Dahl was hired by Joyent.

Node in the heavens

Joyent had already explored the idea of using JavaScript on the server side, and Node seemed to fit right into its thinking. Dahl started writing code designed to drive Joyent's infrastructure cloud, and two years on, Node is "heavily used" inside the company's service. It's also a part of Joyent's SDC6 software, which allows ISPs and other outfits to build their own infrastructure clouds.

The company uses Node in tandem with RabbitMQ – an open source messaging platform for sending data across cloud services – and at VMware, Alexis Richardson and crew have built software that lets application developers do much the same thing. They call it rabbit.js.

RabbitMQ already integrates with Java, Ruby, and Python event-based systems – including Spring Integration, EventMachine, and Twisted – and Node was the natural next step. "The combination of Node with Rabbit simplifies the motion of the data. Rabbit is a data-in-motion technology as opposed to storage technology like a database, and Node gives you a handy toolkit for interfacing that world with applications," Richardson says. "Rabbit enables the motion of the data. What Node does is provide a way to program in this style, for JavaScript users."

At the same time, rabbit.js builds on Socket I/O, a Node technology for readily pushing data to client browsers. Designed by LearnBoost CTO Guillermo Rauch, Socket I/O gives developers a single interface for pushing information to WebSocket-enabled browsers as well as browsers that don't support the relatively new push standard.

"Socket I/O gives you a duplex channel, but what it doesn't do is define what you might say or hear over that channel," says VMware staff engineer Michael Bridgen, who built rabbit.js. "RabbitMQ has semantics about how you do messaging, so I thought [the combination of RabbitMQ and node] might be a sweet spot."

The idea is to extend messaging from the cloud to the browser. On the back end, RabbitMQ lets developers pass data without a database. With rabbit.js and Socket I/O, Bridgen and VMware can do much the same when an application is talking to the client, across the web. This is just the sort of thing Node is designed to do.

Node Knockout

Node Knockout

"I think Node itself recognizes that web programming is more about network programming than it is about databases," Bridgen says. "It's about taking on some data, sending it on in that direction, and then something comes back and sending that back on again. It's about shuffling data here and there. One of the reasons that Node has been successful is that it makes that kind of asynchronous data shuffling accessible to people by couching it in JavaScript."

Rauch agrees. Node drives the length and breath of his LearnBoost app. With node, he says, you can use the same language on the front end and the back end. "That's what's so appealing," he says. "You can write your web application in JavaScript, and you can write all your back-end infrastructure in JavaScript, and you can write your client web application in JavaScript. It really is a single-stack world."

More about

TIP US OFF

Send us news


Other stories you might like