DEV Community

Vadym Kazulkin for AWS Community Builders

Posted on • Edited on

3

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

Introduction

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

In this article we'll measure performance (cold and warms 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 the part 2 and give all Lambda functions 1024 MB 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 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 warms starts) of the pure Lambda function having 1024 MB of memory using 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 the separate article.

At the time of publishing also newer versions became available (like GraalVM 23 runtime) so you case make the version changes and re-compile GraalVM Native image following the instructions from the 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 MBs) 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 .

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post