Top of Page
July 31, 2012
(Original Japanese article translated on December 12, 2012)
"Node.js" is currently a hot topic among software developers. In the first half of this article we describe the road leading to the creation of Node.js as well as the history of its development. In the latter half we examine the technical aspects of Node.js, giving an outline of its architecture, and looking at future issues and prospects. The official name given to Node.js is Node. It is referred to as Node.js when it is necessary to explicitly distinguish it from other technologies, but here we stick to this naming because it is easily understandable for beginners.
Meanwhile, on the Internet a large number of services targeting the social and mobile domains have come to the fore, leading to demand for the development of systems that allow more users to exchange data simultaneously in real-time. Attempting to meet the need for this kind of service using conventional LAMP (Linux/Apache/MySQL/PHP) based systems would require an extremely large amount of hardware resources to achieve the necessary performance (this is known as the C10k problem ).
To overcome this problem, event-driven I/O handling libraries such as libevent and libev/libeio were developed. High-performance applications that utilize these libraries such as nginx and memcached have begun to appear.
"Node's goal is to make non-blocking network programming accessible to users who are not well-versed in server development".
From a developer's perspective, Node.js does not require knowledge or technical ability in complex multi-threaded programming like C or Java, as it runs as a single process and thread. This allows developers to develop applications in a similar manner to standard programming in browsers. It also features an npm (node package manager) function for creating, publishing, and installing third-party modules, which enables users to expand its functionality easily. When Node.js was released as open source, many interested developers worldwide joined and contributed to the Node.js project on GitHub, and its development continues to proceed at a rapid pace.
Node.js versions are split between even-numbered stable releases, and odd-numbered development ones. At the time of writing four stable releases had been put out (node-v0.8.x is the latest stable release as of July 2012). From November 2010 the Node.js project has been sponsored by Joyent, a U.S. cloud provider, and many other cloud providers and startup companies around the world are involved. Microsoft also joined the project in 2011, and they currently provide Node.js on their Windows Azure service.
The following figure shows an overview of Node.js architecture.
Node.js currently supports four OS types -- Linux, BSD-based OSes (Mac OS/FreeBSD/OpenBSD), Solaris (SmartOS), and Windows. It utilizes the asynchronous I/O system calls specific to each OS (epoll/kqueue/eventport/IOCP), but for Unix-based OSes the "libev" library is used for asynchronous I/O system calls (epoll/kqueue/event port). Because Windows environments utilize unique asynchronous system calls (IOCP), from node-v0.6 the special "libuv" event library integrating both was developed for Node.js, making it possible to use the same API on both Unix and Windows.
At its core, Node.js is designed to provide the functions required by server-side applications in the simplest way possible, to enable the creation of runtime environments that match the intended purpose and convenience. Node.js is still under active development, with further stability and performance enhancements as the current priority.
Despite the attention Node.js is receiving, it does have a number of disadvantages and issues. We take a look at some of these here.
As mentioned above, Node.js basically runs as a single process and thread. However, by itself it cannot make full use of the hardware performance offered by recent highly-integrated multi-core servers. From node-v0.6 a cluster module was introduced that allowed Node.js to run multiple processes, but programming needs to be designed to use multiple processes. In contrast, Node.js shows good performance on comparatively low spec servers, because it is able to make full use of single CPU performance. Results from a number of benchmarks in the past showed that processing did not slow down even when several thousand concurrent connections were made using several hundred megabytes of memory. Benchmark tests on Amazon EC2 were performed to create 250,000 concurrent connections, and the results were presented.
The Node.js npm package module is an essential tool for Node.js development. Use of npm enables a variety of functions created by third parties to be utilized easily. However, because anyone can register modules, those providing similar functionality are often submitted by different developers. Registered modules run the gamut from those that are updated with bug fixes and additional functions quite often to those that have not been maintained at all recently. This means users must actively search for modules with the performance that best matches their objectives. To resolve this there have been calls for user ratings and feedback functions like those for smartphone apps, but nothing has been implemented yet.
Strategic Engineering Development Office, Application Development Department, Product Division, IIJ
Mr. Ohtsu joined IIJ in April 1999. After working as a systems integration engineer/consultant and service engineer, he is now focused on the testing and evaluation of new technology for applications, including HTML5, Kinect hacks, and Node.js.
End of the page.