DEV Community

Vadym Kazulkin for AWS Heroes

Posted on • Edited on

Lambda function with GraalVM Native Image - Part 5 Measuring cold and warm starts with GraalVM 23

Introduction

In part 2 of this article series, we explained how to develop and deploy a Lambda function based on GraalVM Native Image with Custom Runtime using GraalVM version 21, and in part 3, we measured the Lambda performance (cold and warm starts) with this approach. Since then, GraalVM 23 was released, and many dependencies used in our sample application got their version updates. So, it was time for me to update the application to the newest versions available by the end of December 2024 and to re-measure Lambda performance.

Sample Application

General setup and the idea of the sample application described in part 2 remained the same, but I published the updated version of the sample application here. It not only uses GraalVM 23.0.1 as its base but also includes all updated AWS dependencies like bom from software.amazon.awssdk but also other AWS dependencies like aws-lambda-java-core, aws-lambda-java-events, aws-lambda-java-serialization to the newest versions. The same was true also for other dependencies like lambda-runtime-graalvm (from com.formkiq) and even native-image-maven-plugin, see the pom.xml. The source code and IaC basically remained the same, but few other logging classes needed to be initialized at the build time and had to be added to native-image.properties. It's probably more convenient to include the whole package org.slf4j into Native Image Build Configuration than adding so many individual classes to the --initialize-at-build-time and --trace-class-initialization properties.

Measuring cold and warm starts of Lambda function with Custom Runtime containing GraalVM 23 Native Image

The approach to execute the Lambda performance measurements described in part 3 remained the same. Here are the results :

Cold (c) and warm (m) start time in ms:

c p50 c p75 c p90 c p99 c p99.9 c max w p50 w p75 w p90 w p99 w p99.9 w max
618.18 628.78 638.28 667.64 705.37 705.61 4.03 4.62 5.25 10.33 38.76 103.27

Conclusion

In this article, we measured performance (cold and warm start times) of the pure Lambda function having 1024 MB of memory using the Custom Runtime containing GraalVM 23 Native Image.

Compared to the Lambda performance measurements from part 3 done with GraalVM 21 Native Image and older versions of their dependencies, we observe that the cold start time with GraalVM 23 increased between 50 and 100ms, depending on the percentile. This might have something to do with the bigger native image artifact size, as the updated versions of the dependencies were mostly bigger in size than the previous ones. The bigger the Lambda artifact size is, the higher the cold start generally will be. On the other side, the warm start/execution time slightly decreased for nearly all percentiles, which suggests that some improvements have been introduced within GraalVM 23 and the Native Image.

If you have read my articles and liked their content, please support me by following me on my GitHub account and giving my repos a star.

Top comments (0)