Site icon IT World Canada

JavaScript graduates to the server

SAN FRANCISCO — Although it is just three years old, Node.js is gaining traction as an application development platform, letting developers extend JavaScript beyond the browser and into servers. But questions remain about JavaScript’s appropriateness on servers and developers’ readiness to use it.

Invented by Joyent developer Ryan Dahl, Node.js — or simply Node — is getting endorsements from established companies such as Microsoft and Yahoo, as well as from smaller ventures. Geared to network application development, the platform is built on the Google Chrome V8 JavaScript engine and features an event-driven, nonblocking I/O model that advocates say make it ideal for data-intensive, real-time applications running across distributed devices.

Dahl even sees Node.js displacing Java on servers. “Java got very complicated, and what was really nice about JavaScript two years ago was that it was this very simple language,” Dahl says. “It had strings, and it had numbers and functions, but there really wasn’t all that [much] else to it.” But JavaScript did have capabilities such as closures and anonymous functions, Dahl noted: “That kind of set the stage to introduce a new server paradigm that focuses on nonblocking I/0.”

JavaScript founder Brendan Eich, CTO at Mozilla, is not surprised that JavaScript has been extended beyond the browser and into servers. “I expected it because Netscape actually wanted to do that,” Eich says. Developers “like a full-stack, end-to-end, one-language development model.”

Big-time support for Node.js

Microsoft is backing Node.js as a development language on the company’s Windows Azure cloud platform. The company offers its Windows Azure SDK for Node.js. “Over the next couple of weeks, you’re going to see basically us round out all of the features of Azure to have integrated Node.js libraries,” says Microsoft vice president Scott Guthrie.

Mozilla is using Node.js in its identity project, for single sign-on for the Web. Because JavaScript is already the language of the browser, it makes sense that the programs that browser applications connect to are also written in JavaScript, says Mark Mayo, a principal engineer at Mozilla.

In November, Yahoo introduced its Cocktails technology for Web developers, featuring Node.js, JavaScript, HTML5, and CSS. Initial deliverables include Mojito, an environment-agnostic Web application framework for the client and server, and Manhattan, a hosted platform for Mojito applications. “The way we leverage Node.js in Manhattan is by having Node.js be the execution core of Manhattan,” says Renaud Waldura, a senior product manager at Yahoo. Manhattan adds several high-end services not available in Node.js itself, such as security and isolation, he says.

Node.js also is catching on at lesser-known companies such as GroupDock, which provides a business application platform for HTML5 applications that can work on computers and mobile devices.

Node.js is no panacea
Although Node.js is generating a lot of positive buzz, not everyone is sold on it. Ted Dziuba, a senior technical staff member at eBay, has posted a profanity-laced blog in which he declares, “Node.js is cancer.” In the blog, he calls it a “scalability disaster waiting to happen.” He also argues a server-side framework should not be written in JavaScript and says Node.js disobeys the Unix way.

“I got into most of the detail on my blog, but I believe that JavaScript is a bad server-side language because it was never designed to be a server-side language,” Dziuba says. “Because JavaScript has always been client-side, browser implementers assume its use is pretty lightweight. For example, it was only in September that a Node.js server-side process could allocate more than 1GB of memory, because of limits in Google’s V8 JavaScript engine.”

Node.js creator Dahl acknowledges Dziuba’s concerns, but says they are not mainstream: “This person makes complaints about how CPU- bound tasks can block a process — which is true. Most servers we see are I/O-bound — not calculating numbers in a tight loop — so they do not hit this problem. If there is a CPU-bound part of a server, we provide a number of methods for running it in parallel — which [Dziuba] does not consider (for example, a child_process.fork). It certainly is not a scalability disaster waiting to happen.” Dahl cites the smartphone application builder Voxer, which runs hundreds of Node processes to do VoIP, processing thousands of parallel processes.

Node.js, says IDC analyst Al Hilwa, has strengths in Web applications that follow an event-driven model: “The asynchronous nature of the language and its similarity to JavaScript, which is of course not Java, are the key assets making it much easier to express concurrency in the application.” But he adds there is a big gap between developers who can use JavaScript at the basic level and those sufficiently skilled enough to build complex applications, such as what Node.js requires. “This situation is improving and the JavaScript syntax is being more broadly adopted by many tools and runtimes, but it would be a mistake to assume that any JavaScript developer is sufficiently skilled with Node.js to hit the ground running in a project.”

Whereas Dahl sees Node.js as a Java replacement on servers, others disagree. “The short answer is no, we don’t see Node.js displacing PHP or Java,” says Solomon Hykes, CEO of DotCloud, which offers a cloud computing platform that supports Node.js. “But we’re seeing two very important trends: First, the landscape of server-side languages and frameworks is increasingly fragmented — and applications increasingly need to combine several of them to be successful. So we’re going to see more of Java and Node.js, more of PHP plus Node.js, for example, all working together in the same application.”

Where Node.js is headed

The developers of Node.js hope to have a stable 0.7 release of the platform ready by March. It will support isolates, a type of parallel JavaScript thread. This enables shared memory between isolates in add-ons and allows for advanced optimization techniques such as rendering multiple parts of a page in parallel, Dahl says.

A formal 1.0 version should arrive this summer, Dahl says. Among features planned for Node.js, although not necessarily in the 1.0 release, are binary modules, which allow developers to interface with system libraries written in C. “For example, if you needed to connect to Oracle, you would want a binary module to interface with the database driver,” he says. Also eyed is a versioning scheme for APIs, in which internal APIs would be labeled with a stability level.

With developers latching onto the opportunity to use JavaScript beyond browsers, Node.js’s usage is destined to grow. Its acceptance by major technology players gives it a place alongside technologies such as Java and PHP, even if it is still a very young platform.
 
(From Infoworld.com)
Exit mobile version