The release of Node.js 19.0, a platform for executing network applications in JavaScript, has taken place. Node.js 19 has been relegated to a regular support branch with updates until June 2023. In the coming days, the stabilization of the Node.js 18 branch will be completed, which will receive LTS status and will be supported until April 2025. Maintenance of the previous Node.js 16.0 LTS branch will last until September 2023, and the previous 14.0 LTS branch until April 2023.

Server-side JavaScript platform Node.js 19.0 available

Main improvements:

  • The V8 engine has been updated to version 10.7 used in Chromium 107. Changes in the engine compared to the Node.js 18 branch include the implementation of the third version of the Intl.NumberFormat API, which adds new functions formatRange(), formatRangeToParts() and selectRange(), grouping of sets, new options for rounding and specifying precision, the ability to interpret strings as decimal numbers. The bundled llhttp 8.1.0 and npm 8.19.2 dependencies have also been updated.
  • An experimental “node –watch” command has been proposed with the implementation of a watch mode that ensures that the process is restarted when an imported file changes (for example, if “node –watch index.js” is executed, the process will be automatically restarted when index.js changes).
  • For all outgoing HTTP/HTTPS connections, support for the HTTP 1.1 Keep-Alive mechanism is enabled, which leaves the connection open for a certain time to process several HTTP requests within a single connection. It is assumed that the use of Keep-Alive will improve throughput and performance. By default, the connection keep open timeout is set to 5 seconds. Support for parsing the Keep-Alive HTTP header in server responses has been added to the HTTP client implementation, and automatic disconnection of idle clients using Keep-Alive has been added to the Node.js HTTP server implementation.
  • The WebCrypto API has been moved to the stable category, with the exception of functions using the Ed25519, Ed448, X25519 and X448 algorithms. You can now use globalThis.crypto or require(‘node:crypto’).webcrypto to access the WebCrypto module.
  • Removed support for the DTrace, SystemTap and ETW (Event Tracing for Windows) tracing tools, the maintenance of which was deemed impractical due to the difficulty of keeping up-to-date in the absence of a proper plan for their support.

The Node.js platform can be used both for server maintenance of Web applications and for creating regular client and server network programs. To expand the functionality of applications for Node.js, a large collection of modules has been prepared, in which you can find modules with the implementation of HTTP, SMTP, XMPP, DNS, FTP, IMAP, POP3 servers and clients, modules for integration with various web frameworks, WebSocket and Ajax handlers , DBMS connectors (MySQL, PostgreSQL, SQLite, MongoDB), templating engines, CSS engines, implementations of crypto algorithms and authorization systems (OAuth), XML parsers.

You may be interested in: Installing Node.js on CentOS 8 and Installing Node.js on Ubuntu

To ensure the processing of a large number of parallel requests, Node.js uses an asynchronous code execution model based on non-blocking event handling and the definition of callback handlers. Supported methods for multiplexing connections are epoll, kqueue, /dev/poll, and select. For connection multiplexing, the libuv library is used, which is an add-on for libev on Unix systems and IOCP on Windows. The libeio library is used to create a thread pool, and c-ares is integrated to perform DNS queries in non-blocking mode. All system calls that cause blocking are executed inside the thread pool and then, like signal handlers, transfer the result of their work back through an unnamed pipe (pipe). The execution of JavaScript code is provided through the use of the V8 engine developed by Google (in addition, Microsoft is developing a version of Node.js with the Chakra-Core engine).

At its core, Node.js is similar to the Perl AnyEvent, Ruby Event Machine, Python Twisted frameworks, and the Tcl event implementation, but the event loop in Node.js is hidden from the developer and resembles event handling in a web application running in browser. When writing applications for node.js, you need to consider the specifics of event-driven programming, for example, instead of doing “var result = db.query(“select..”);” with waiting for completion of work and subsequent processing of results, Node.js uses the principle of asynchronous execution, i.e. the code is transformed into “db.query(“select..”, function (result) {result processing});”, in which control will instantly pass to further code, and the query result will be processed as data arrives.

Source: The article is distributed under the CC-BY-SA license

Leave a Reply