Listen to this Post

Introduction
AWS Lambda is a powerful serverless computing platform, but cold and warm start latencies can impact performance. Vadym Kazulkin’s latest blog post explores optimization techniques for Quarkus 3 applications on AWS Lambda, covering both managed Java runtime and GraalVM Native Image deployments. This article extracts key technical insights and provides actionable commands and configurations to enhance Lambda performance.
Learning Objectives
- Understand how Lambda SnapStart reduces cold start times for Java applications.
- Learn priming techniques to optimize Quarkus 3 on AWS Lambda.
- Deploy Quarkus as a GraalVM Native Image for faster startup.
You Should Know
1. Enabling Lambda SnapStart for Java Runtimes
Verified AWS CLI Command:
aws lambda update-function-configuration \ --function-name YourFunctionName \ --snap-start ApplyOnPublishedVersions
Step-by-Step Guide:
- Ensure your Lambda uses Java 11 or later.
- Run the above CLI command to enable SnapStart.
- Publish a new version (
aws lambda publish-version --function-name YourFunctionName). - SnapStart pre-initializes your function, reducing cold starts by up to 90%.
2. Priming Techniques for Quarkus 3
Quarkus Configuration Snippet (`application.properties`):
quarkus.lambda.snapstart.enabled=true quarkus.lambda.handler=your.Handler
Steps:
1. Add the above to your `application.properties`.
2. Use classloading hints to preload critical dependencies:
quarkus.native.additional-build-args=-H:ClassInitialization=com.example.Class:build_time
3. Test with `curl` or AWS Console to verify reduced cold starts.
3. Deploying Quarkus as GraalVM Native Image
Docker Build Command:
./mvnw package -Pnative -Dquarkus.native.container-build=true
Steps:
1. Install GraalVM and configure `JAVA_HOME`.
- Run the above command to compile a native binary.
3. Deploy using AWS SAM or CDK:
Resources: MyFunction: Type: AWS::Serverless::Function Properties: Runtime: provided.al2 Handler: bootstrap CodeUri: target/function.zip
4. Measuring Cold/Warm Start Times
AWS CloudWatch Query:
FILTER @type = "REPORT" | STATS avg(@initDuration), avg(@duration) BY @functionName
Steps:
1. Navigate to CloudWatch Logs Insights.
2. Run the query to compare before/after optimizations.
5. Reducing Deployment Package Size
Maven Clean Build:
./mvnw clean package -Dquarkus.package.type=uber-jar
Steps:
1. Strip unused dependencies with `quarkus.minify=true`.
2. Use ProGuard or manual exclusions in `pom.xml`.
What Undercode Say
- Key Takeaway 1: SnapStart is a game-changer for Java Lambda functions but requires versioned deployments.
- Key Takeaway 2: Native Images eliminate JVM overhead but increase build complexity.
Analysis:
The balance between SnapStart and Native Image deployments depends on use-case constraints. For infrequent invocations, SnapStart’s pre-initialization is ideal. For high-performance needs (e.g., real-time APIs), Native Images reduce latency but require GraalVM expertise. Future Lambda updates may unify these approaches with deeper JVM integrations.
Prediction
As serverless adoption grows, AWS will likely introduce language-specific cold start optimizations (e.g., pre-warmed JVMs for Java). Quarkus’s native support will mature, bridging the gap between SnapStart and GraalVM performance.
For Vadym’s full guide, visit:
IT/Security Reporter URL:
Reported By: Vadymkazulkin Java – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


