NodeJS 19: Boosted HTTP Throughput & Node --Watch

NodeJS 19 has officially arrived. Some of the major highlights include the update of the V8 JavaScript engine to 10.7, and HTTP(s)/1.1 KeepAlive enabled by default. NodeJS 19 will replace Node.js 18 as the current release line when NodeJS 18 is now entering the long-term support (LTS) status later this month. As per the release schedule, NodeJS 19 will be the current release for the next 6 months, until April 2023.

With this release, Node.js sets keepAlive to true by default. Thus any outgoing HTTP(S) connection automatically will use HTTP 1.1 Keep-Alive, providing better throughput as connections are reused by default. There is a default waiting window of five seconds. Additionally, Node’s HTTP Agent is able to parse the response Keep-Alive that servers might send. This header instructs the client on how long to stay connected. The Node HTTP server now will automatically disconnect idle clients when close() is invoked.


[ Want to continue reading more of our content? Try some of our member-only content that we love to write. Membership is free! Sign up by clicking the subscribe button at the bottom right. ]

What is NodeJS?
Scalability, latency, and throughput are key performance indicators for web servers. Keeping the latency low and the throughput high while scaling up and out is not easy. Node.js is a JavaScript runtime environment that achieves low latency and high throughput by taking a “non-blocking” approach to…

The increased frequency of NodeJS releases means that cool features are now being added over time, yet NodeJS 19 includes the following changes and updates.

node --watch (experimental)

An exciting recent feature addition to the runtime is support for running in ‘watch’ mode using the node --watch option. Running in ‘watch’ mode restarts the process when an imported file is changed.

$ node --watch index.js

This feature is available in v19.0.0 and v18.11.0+.

Contributed by Moshe Atlow in #44366

HTTP(S)/1.1 KeepAlive by default

Starting with this release, Node.js sets keepAlive to true by default. This means that any outgoing HTTP(s) connection will automatically use HTTP 1.1 Keep-Alive. The default keep-alive duration is 5 seconds.

Enable keep-alive will deliver better throughput as connections are reused by default.

Additionally, the agent is now able to parse the response Keep-Alive which the servers might send. This header instructs the client on how much to stay connected. On the other side, the Node.js HTTP server will now automatically disconnect idle clients (which are using HTTP Keep-Alive to reuse the connection) when close() is invoked).

Node.js HTTP(S)/1.1 requests may experience a better throughput/performance by default.

Contributed by Paolo Insogna in #43522

Stable WebCrypto

The WebCrypto API is now stable (with the exception of the following algorithms: Ed25519, Ed448, X25519, and X448)

Use globalThis.crypto or require('node:crypto').webcrypto to access this module.

Contributed by Filip Skokan in #44897

Custom ESM Resolution Adjustments

Node.js has removed the --experimental-specifier-resolution flag. Its functionality can now be achieved via custom loaders.

Contributed by Geoffrey Booth in #44859

DTrace/SystemTap/ETW Support

Support for DTrace/SystemTap/ETW was removed in v19.0.0. The main reason is the prioritization of resources. The complexity to keep the support up-to-date has proved not worth it without a clear plan to support these tools.

If you are interested in helping to bring DTrace back, an issue has been opened here: https://github.com/nodejs/node/issues/44550.

Contributed by Ben Noordhuis in #43651 and #43652

Dependencies

V8 10.7

The V8 engine is updated to version 10.7, which is part of Chromium 107. This version includes a new feature to the JavaScript API: Intl.NumberFormat.

Intl.NumberFormat v3 API is a new TC39 ECMA402 stage 3 proposal extending the pre-existing Intl.NumberFormat.

The V8 update was a contribution by Michaël Zasso in #44741.

llhttp

Node.js 19 ships with [email protected]

Contributed by Paolo Insogna in #44967

npm

Node.js 19 ships with [email protected]

Rafael Gonzaga from Nearform and Ruy Adorno from Google have been working as the release leads for this version.

With over 1,150 commits since the last release, NodeJS continues to improve along a broad spectrum of functionality. Improvements in connectivity, performance and throughput are important parts of NodeJS 19. We’ve been working hard on making Node.js more secure and performant, and I believe we are getting better and better. If you’re in active deployment, NodeJS 18 LTS is for you. If you’re interested in getting access to features early, NodeJS 19 is ready. Many thanks to our open source contributors for making Node.js better and better.

To download NodeJS 19 visit: https://nodejs.org/en/download/current/. You can find the release post at https://nodejs.org/en/blog/release/v19.0.0, which contains the full list of commits included in this release.