In association with heise online

Creation story

Ryan Dahl, creator of Node.js, was inspired to create Node.js after being challenged by the problem of, and complexity of solutions to, updating a progress meter on a web page for uploading files with Ruby web servers. "It amazed me this was such a hard problem", said Dahl in a 2010 interview. He was impressed by Mongrel, the dynamic Ruby web server. The JavaScript "arms race" provided the language which Dahl believed could be used easily by web developers more used to working in the browser, and he combined it with his knowledge of event-driven servers to create the first versions of Node. Because JavaScript has lacked server-side libraries, Dahl and other developers have had to create what are regarded as standard libraries for the server-side JavaScript. This has given Node.js an advantage over other event driven frameworks though as the libraries are written to be event-driven throughout; in other frameworks, it is easy to find situations where the non-event aware standard libraries are called, which thus creates blocking.


Node.js has taken off, with many leading-edge web developers using it as the backend for their prototype systems. What has helped propel that adoption is a functional ecosystem of reusable libraries. NPM, the Node Package Manager, currently lists over 4,400 packages, with popular packages such as utility libraries such as Underscore, simplifying libraries such as request, and template engines such as Jade. One library which is responsible for the wider use of Node.js is this implements real time connectivity between clients and servers by automatically selecting the appropriate connection technology, be it WebSockets, AJAX polling, AJAX streaming or others, depending on the capabilities of the browser. This library makes creating dynamic web applications much easier by removing the complexity of sniffing browsers and managing connections and has, therefore, been picked up by developers who want to prototype those new dynamic web applications.

One of the more interesting applications for Node.js was as an application platform; in WebOS 2.1, the developers of the OS added it to their mobile platform to allow developers to create local services written in JavaScript for local applications. Another intruiging use is running on the recently released BeagleBone board where users can log in, over the network and create Node.js scripts to control the board and it's I/O ports.

The most recent addition to the Node.js ecosystem is the arrival on Node.js 0.6.0 which is the first release of Node with a native Windows port. This has the potential to expand Node usage even further.

Pros and cons

People often say that Node.js is scalable, but for Node.js there's a specific meaning to that: Node.js, in and of itself, makes good use of a single core of a processor when handling I/O bound tasks, more so than many other techniques. But when you want to use more cores, or when you want more systems running a Node.js application, you have to fall back on more traditional scaling: running the Node.js application on many cores or systems and putting a load-balancing web server in front of it to distribute that work around. So while it is possible to scale Node.js across networks, developers end up implementing the same web server infrastructure as they would with any other underlying backend technology. That said, Node.js's efficient exploitation of each core could lead to less need for so much distributed infrastructure.

What Node.js isn't going to replace is the computing and querying services that do the heavy lifting for a web-scale application, despite V8 being an effective JIT JavaScript compiler. It is equally important to realise that Node.js is not a new universal platform for all applications, but one that addresses important niches in the architecture of modern systems; the most important and useful of those niches is as "Web glue", acting as an interconnecting part for other web applications. Node.js lets developers create this glue quickly because they should be relatively familiar with the language and because the event-driven model tends to make them write code which makes efficient use of limited resources. As such, Node.js should be a useful addition to a developer's toolkit of languages and platforms. By the same token though, there's nothing to stop a developer writing their entire application in Node.js; it's a framework that has been built on challenging the idea that "You can't do that in JavaScript".

Next, for those who want to delve deeper, we'll walk through a simple Node.js server and offer up some selected Node.js resources.

Next: A simple Node.js server

Print Version | Permalink:
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit