Java 11 vs 8 performance for AWS Lambda

Aleksandr Filichkin
4 min readApr 18, 2020

We are running a lot of serverless applications in AWS and I was really happy that AWS finally introduce Java 11 support for AWS Lambda.

I guess many teams already switched to Java 11 and think that it brings some performance improvement. AWS Lambda Java 11 was announced in November 2019. Lambda functions are written in Java 11 run on Amazon Linux 2, the latest generation of Amazon Linux, and Amazon Corretto 11. Sounds like it should be faster than old Java 8 stuff.

Unfortunately, there is no performance comparison between Java 8 and 11 runtimes for AWS Lambda.

Let's compare AWS Lamda's performance for Java 8 and 11 runtimes.

What our Lambda will do?

API Gateway+AWS Lambda+DynamoDB

Test flow

This is the most popular architecture use case for AWS Lambda.

Let's write the code.

All code you can see as usual in my GitHub (

So Handler class implement RequestHandler and overrides one public handleRequest.

You can ask why we have this static stuff :)

This is not a mistake, this is the AWS Lambda killer feature. Load classes, warm-up all clients on startup. Why? Because of AWS provides all available CPU(CPU Burst) during Lambda initialization(first lambda instance invocation). It reduces initialization significantly!

I highly recommend you to watch this excellent AWS Lambda Java tuning video

I improved the code as much as possible.

  1. Use CPU burst on Lambda startup
  2. Get rid of IoC frameworks such as Spring/Guice/Dagger 1
  3. Reduce jar file and load as fewer classes as possible. (Jar size is 6Mb, quite small for Java)