AWS Lambda Node.js 10 Support and Benchmark

AWS has officially released the support for Node.js 10.x runtime in their AWS Lambda service. The Node.js 10.x runtime is available in all regions where Lambda is available. Node.js 10 (AKA “Dubnium”) is the official LTS version.

Node.js 10 brings some difference in the runtime and the SDKs compares to Node.js 8.10:

Name Identifier Node.js Version AWS SDK for JavaScript Operating System
Node.js 10 nodejs10.x 10.15 2.437.0 Amazon Linux 2
Node.js 8.10 nodejs8.10 8.10 2.290.0 Amazon Linux

Node.js 10 vs Node.js 8

The most notable differences between the versions are:

  1. Performance improvements with V8 Engine v6.6 – Node is powered by the V8 JavaScript Engine (used in Chromium), and Node.js v10 comes with the latest release. Benchmarks show the V8 Engine v6.6 which ships with Chrome 66 provide a reduction of around 20–40% in both parse and compilation time.
  2. Adding Error Codes – Errors in Node have now been standardized to have consistent codes with a repeatable pattern.
  3. N-API is no longer experimental.
  4. Native Node HTTP/2 becomes stable.
  5. Upgrade to OpenSSL version 1.1.0.

Performance comparison

At Epsagon, we already support the latest version in the tracing library, and as always – we love to benchmark and compare between different runtimes. We conducted the test on a 128MB Lambda, with the following simple snippet:

exports.handler = async (event) => {
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    return response;
};

We measured both the cold starts and the avg. duration of the function, using artillery, over a period of an hour. The results were a bit surprising:

benchmark

It seems that v10 is performing worse both in the average cold start duration and the general average duration for the response. This, however, might happen due to the fact it’s still new.