Feeds

The Node Ahead: JavaScript leaps from browser into future

Google V8 engine spawns server world doppelgänger

Boost IT visibility and business value

All the way to the end

In the beginning, Ryan Dahl didn't see node as a platform for "end" developers, coders building end-user applications. But he was proven wrong almost immediately. "We thought Node was just kinda about opening TCP connections, a kind of low-level thing, something you do low down in the operating system," he says. "But people starting building websites with it."

To tap this interest, Joyent built no.de, a means of using Node as a service, through a web browser. For LearnBoost's Rauch, node is – more so than other systems – tailor-made for this sort of platform-as-a-service (PaaS). "Node is really well-suited for the cloud," he says. "Running a node server uses few resources, but it's able to handle really large numbers of users."

With no.de, you essentially build a git repository with a Node server, and you push it to a virtual machine running on Joyent's infrastructure cloud. It starts up the daemon and makes sure the daemon keeps running. The underpinnings of the service are also included with SDC6, so that third parties can run their own no.de.

According to Joyent's Tom Hughes-Croucher, when benchmarking its Node setup the company has set up a 'hello world' server that can handle 8,000 requests per second from a single CPU core. "It's just saying 'hello world,'" he says. "But still." He says that some apps have been known to accomodate 15,000 concurrent users from a single server.

Because it's so efficient, Hughes-Croucher believes Node is on the verge of hitting it very big among end developers. But as Ryan Dahl points out, this is still a niche platform. "Most people are working on asp or Java or PHP," he says. "They're not looking for new platforms. They've got their company. They will use the next product from Microsoft, but they're not in search of a new runtime to use."

What's more, the concepts are very different from what developers expect in the multithreaded world. "You're forced into this non-blocking style," Dahl says. "Anytime you want to talk to this remote back end or something, you have to give a callback. You can't say 'Database give me the result and then in the next line use the result.' You have to somehow have a callback, so you get indented a bit or you jump into a different function.

"It can be very painful for people when you have to do a lot of things in serial – a and then b and then c and then d. In a typical blocking language, you would just do a, b, c, and d, one after another, each on its own line. In node, you have to jump into different functions for each of those. You have to request that the database send you some data, go back to the event loop, handle other requests, get the response, call some function that sends off the next request, go back to the event loop, handle more requests."

The flip side is that the platform should feel quite confortable to those who use JavaScript on the front end, who have little history on the server side. "For client-side people, the non-blocking style is all pretty natural. They wouldn't think about it another way."

Node Knockout code

Node Knockout code

The overarching point, however, is that Node is optimal for the new breed of real-time web apps. Yes, there are other means of building real-time tools, but Node lets you build real-time tools on the same platform that runs the rest of your site. Famously, Facebook's chat server was built with Erlang, but as Guillermo Rauch points out, the rest of Facebook wasn't.

"If you have a traditional stack with, say, PHP and Apache, doing real time is almost impossible," Rauch says. "You always have to offload your real-time communications to a different webserver or a specialized webserver you write yourself. Facebook wrote an Erlang server just for Facebook chat and they made it talk to their PHP stack. With Node, all those infrastructure complications are completely removed. You can write your real-time stack right in the same codebase as your normal web application, your database-management layer, and everything else."

So Node is neither The New Rails nor The New PHP. It's something else entirely. ®

Boost IT visibility and business value

More from The Register

next story
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
Mozilla keeps its Beard, hopes anti-gay marriage troubles are now over
Plenty on new CEO's todo list – starting with Firefox's slipping grasp
Apple: We'll unleash OS X Yosemite beta on the MASSES on 24 July
Starting today, regular fanbois will be guinea pigs, it tells Reg
HIDDEN packet sniffer spy tech in MILLIONS of iPhones, iPads – expert
Don't panic though – Apple's backdoor is not wide open to all, guru tells us
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Backing up Big Data
Solving backup challenges and “protect everything from everywhere,” as we move into the era of big data management and the adoption of BYOD.
Boost IT visibility and business value
How building a great service catalog relieves pressure points and demonstrates the value of IT service management.
Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.