AWS Lambda battle: x86 vs ARM(Graviton2)

As you may know, just a month ago AWS announced AWS Graviton2 Processors for AWS Lambda and says that AWS Lambda functions using the Arm/Graviton2 architecture provide up to 34 percent price-performance improvement.

In this article, we are going to check what real price-performance improvement we can see for the most common lambda use-case.

This article is a continuation of my previous article AWS Lambda battle 2021: performance comparison for all languages (cold and warm start)

Thank you so much to everyone who contributes to https://github.com/Aleksandr-Filichkin/aws-lambda-runtimes-performance. As you will see we significantly improved performance for NodeJs https://github.com/Aleksandr-Filichkin/aws-lambda-runtimes-performance/pull/6

Disclaimer:

All benchmarks were performed in November 2021

I’m not an expert in all these languages and I’m happy to see MR in GitHub repo with performance improvements. I’m going to support these repo and run the perfomance test every 3 months. I believe in opensource collaboration :)

Test scenario

We are going to compare performance for ARM and x86 for cold and warm states for all supported runtimes + Rust and Graalvm:

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

All source code is here: https://github.com/Aleksandr-Filichkin/aws-lambda-runtimes-performance

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

We will test only POST endpoint which will save the book into the DynamoDb table in the known AWS region(us-east-2).

The main flow

Cold start

Cold start
Cold start per runtime

Warm state

For the warm state, I sent 15k requests for each lambda one by one(lambda concurrency is 1, all request go to the same lambda instance).

And on the screens, you can see the duration of the last requests, which means all JIT/optimization should be done.

DotNet: ARM is a bit faster

DotNet ARM vs x86

Golang: ARM and x86 are almost the same

Go comparison

GraalVM: x86 is a bit faster

GraalVM ARM vs x86

NodeJS: ARM is a bit faster

NodeJS ARM vs x86

Python: ARM is faster

Python ARM vs x86

Ruby: almost the same performance

Ruby ARM vs x86

Rust ARM is faster

Rust ARM vs x86

Java: almost the same performance

Java ARM vs x86

All Runtime together

all runtimes ~12k iterations
128 MB (15k iteration for single lambda instance)
256MB (15k iteration for single lambda instance)

Migration effort

To move your Lambda to ARM runtime you just need to add a new field in CF/SAM script.

But:

Conclusion:

For this particular test for all runtimes (except GraalVM) we see that ARM/Graviton2 processor is faster and 20% cheaper than x86.

Since the development effort is minimal (except Rust and Goland) I would recommend migrating to ARM setup as fast as possible.

--

--

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