AWS Lambda battle 2021: performance comparison for all languages (cold and warm start)
--
Let’s compare the performance of all supported runtimes + 2 custom runtimes (Rust and GraalVM).
Will compare cold start and warm.
Source code is here: https://github.com/Aleksandr-Filichkin/aws-lambda-runtimes-performance. It requires the minimum local setup(almost all is Dockerized)
- NodeJs (14.x)
- Python (3.9)
- Go(1.x)
- Ruby(2.7)
- .Net(3.1)
- Java (11)
- Rust(1.54.0)
- GraalVM(21.2)
Disclaimer:
All benchmarks were performed in September 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 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).
Cold start test
I did all my best to reduce the cold start:
- Removed useless dependencies.
- Move as much as possible to the initialization phase(for example, in Java move everything to static) to use CPU burst on startup.
- Specified the Region.
- Got rid of any DI frameworks
The detailed information about cold start read here.
Result:
- 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…