Benchmarking AWS Lambda runtimes in 2021: cold start

  • Java (11)
  • NodeJs (14.x)
  • Python (3.9)
  • Go(1.x)
  • Ruby(2.7)
  • .Net(3.1)
  • Rust(1.54.0)
  • GraalVM(21.2)

Disclaimer:

Test scenario

We are going to test API-Gateway -> AWS Lambda->DynamoDb flow.

The main flow

Cold start

Firstly we are going to test the cold start(the first invocation on AWS Lambda instance) delay. To measure this metric we will use X-Ray tracing. From my point of view, it's the most honest result, because it includes all steps(init/invocation/overhead).

Cold start result

Ruby:

256 MB, Ruby cold start

Python:

256 MB, Python cold start

NodeJS:

256 MB, NodeJS cold start

Golang:

256 MB, Golang cold start

Java:

Java with 128 doesn’t work, it has OutOfMemoryError :)

256 MB, Java cold start

GraalVM:

256 MB, GraalVM cold start

.Net:

256 MB, .Net cold start

Rust:

256 MB, Rust cold start

Summary

  • All languages(except Java and .Net) have a pretty small cold start.
  • Java even cannot start with 128Mb. It needs more memory. But GraalVM can help in this case. Feel free to read a detailed page about GraalVM and AWS Lambda
  • Rust beats all runtimes for all setups, the only exception is 128 MB where Python is the best.
  • The huge setup helps only for Java and .Net.

Next test

The warm comparison you can find in the next article.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store