lambda-perf icon indicating copy to clipboard operation
lambda-perf copied to clipboard

Java Tiered Compilation

Open rk29 opened this issue 2 years ago • 2 comments

I've seen good improvements for Lambda functions written in Java using tiered compilation, as described in this article:

https://aws.amazon.com/blogs/compute/increasing-performance-of-java-aws-lambda-functions-using-tiered-compilation/

Even just using TieredStopAtLevel=1 my team has seen the cold start times cut in half for many of our Lambda functions. I do think this is something that has more of an affect when you have more initialization code though, so it might not provide as much benefit in this package, since the code in the lambda is minimal. It might be worth a try, and would be a good data point.

I have not measured the results for the combination yet, but Tiered Compilation can also be combined with SnapStart.

rk29 avatar May 13 '23 17:05 rk29

Tiered Compilation can be enabled just by setting an environment variable, as described here:

https://aws.amazon.com/blogs/compute/optimizing-aws-lambda-function-performance-for-java/

The other article explains how to do the same thing with a layer, which is probably overkill for this project. A simple environment variable should be much easier to add.

rk29 avatar May 13 '23 17:05 rk29

FYI. Tiered compilation is by default enabled in the Java 17 runtime. I assume this is the same case for Java 21.

jreijn avatar Nov 18 '23 08:11 jreijn