Released stable release Node.js 0.10, a platform for high-performance network applications in JavaScript. The platform can be used as a server for maintenance of Web-based applications, and for creating custom client and server network applications.

To extend the functionality of applications for Node.js prepared a large collection of modules, which can be found in the modules implementing server and client HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3, modules for integration with various web-frameworks, WebSocket handlers and Ajax , connectors to the database (MySQL, PostgreSQL, SQLite, MongoDB), templating, CSS-engines, cryptographic algorithm implementations and systems authentication (OAuth), XML-parser.

For a total of a large number of concurrent requests Node.js uses asynchronous model run code based on event handling in non-blocking mode and callback-handler definition. As methods of multiplexing connections supported by methods such as epoll, kqueue, / dev / poll and select. To multiplex connections using library libuv, which is built on top of libev on Unix and on IOCP in Windows. To create a pool of threads (thread pool) enabled library libeio, to perform DNS-queries in non-blocking mode, integrated c-ares. All system calls that cause blocking, run inside the thread pool, and then, as the signal handlers, send the result to the back through the unnamed channel (pipe). Execute JavaScript-code is provided through the involvement developed by Google engine V8.

At its core Node.js frameworks like Perl AnyEvent, Ruby Event Machine and Python Twisted, but the event loop (event loop) in Node.js is hidden from the developer and the like event handling in web-applications running in the browser. When writing applications for node.js should be specific, event-oriented programming, for example, instead of using “var result = db.query (” select .. “);” with the expectation of completion and subsequent treatment results in Node.js uses the principle of asynchronous, ie code is transformed into “db.query (” select .. “, function (result) {result} processing),” in which control immediately goes to further the code, and the result of the query will be processed upon receipt of the data. None of the functions in Node.js should not directly perform I / O – to get data from a disk from another process or the network requires callback-handler.

The most notable innovations added to Node.js 0.10:

  • New implementation API for streaming I / O – Streams2, eliminating some previously manifested problems such as the inability to read only a fixed number of bytes, leaving the rest of the stream for further processing. In addition, the new system has put all the threads in the core Node.js to use a single set of easily extensible classes, and also facilitate the creation of streaming interfaces in custom applications. New API Streams2 also available as a module readable-stream for past issues Node.js, with 37 modules in a repository is already using the API;
  • Module domain, easy to link several different I / O operations and perform their processing in a single group, registered in terms of functionality and transferred from the experimental to the category of unstable, and in the future will be positioned as a standard way of handling errors in Node.js;
  • A great deal of work to optimize the performance, which is reflected in a marked acceleration performance tests, compared with the 0.8 branch. Some of the tests, especially those associated with I / O and encryption, the new version is faster at times;
  • Changes the way the function process.nextTick (), that is no longer tied to the cycle of event processing and is independent of the I / O operations. New implementation process.nextTick () be respectful accuracy callback-call, regardless of the intensity of the I / O;
  • Reworked the garbage collector, the activation of which is more predictable. If the garbage collector before trying to plan the launch cleaning with an eye on the state of memory and a simple system, which made it impossible to predict when it is activated and how long it will run, especially on busy systems, the new version of the logic of calling the garbage collector rests entirely on JavaScript-engine V8, which is quite advanced in terms of self-organization of cleaning debris.
  • As a result, response system more consistent and predictable.

The next stage of Node.js will release 0.12, which will focus on improving the implementation of support HTTP and possibly as a basic implementation of TLS will be returned to the module tlsnappy. After that, the training of sign release 1.0, which will mark a certain completeness of basic functionality, API stabilization and transition to more stringent criteria to ensure backward compatibility.

Main link to news: http://blog.nodejs.org/2013/03/11/node-v0-10-0-stable/

Advertisements