DEV Community

Vadym Kazulkin for AWS Community Builders

Posted on • Edited on

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

Introduction

In part 2 of the series, we explored how to develop and deploy a pure Lambda function (without using any frameworks like Spring Boot 3) with a Custom Runtime containing GraalVM Native Image with GraalVM 21 runtime.

In this article, we'll measure the performance (cold and warm starts) of the Lambda function using this approach.

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

For our measurements, we'll use our sample application from part 2 and give all Lambda functions 1024 MB of memory.

The results of the experiment below were based on reproducing more than 100 cold and approximately 100.000 warm starts for the duration of 1 hour with the Lambda function GetProductByIdWithPureJava21GraalVMNativeImageLambda, which is mapped to the Java Lambda handler class, which is responsible for retrieving the product (stored in the DynamoDB) by its id. For it, I used the load test tool hey, but you can use whatever tool you want, like Serverless-artillery or Postman.

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
525.77 532.12 542.32 632.56 635.73 636.11 4.16 4.69 5.46 12.30 37.25 211.83

Conclusion

In this article measured performance (cold and warm starts) of the pure Lambda function having 1024 MB of memory is measured using a Custom Runtime containing GraalVM Native Image with GraalVM 21 runtime.

Comparing these performance measurements with from the article Measuring cold and warm starts with Java 21 using different Lambda memory settings, which we did with SnapStart enabled and using priming of DynamoDB request, we see that we have by far the lowest cold and warm start times using GraalVM Native Image comparing to using the pure Lambda function with SnapStart and described priming. Of course, both approaches, SnapStart and GraalVM Native Image, also have different advantages and disadvantages that we'll explore in a separate article.

At the time of publishing, newer versions became available (like GraalVM 23 runtime), so you can make the version changes and recompile the GraalVM Native image following the instructions from part 2 of the series and re-measure the Lambda performance.

In the next article of the series, we'll explore the impact of different Lambda memory settings (from 256 to 1536 MB) on the Lambda performance, as the memory setting also heavily influences the cost of running the Lambda functions.

Update from February 10, 2025: new measurements with GraalVM 23 published in the article Lambda function with GraalVM Native Image - Part 5 Measuring cold and warm starts with GraalVM 23.

Top comments (0)