Vadym79 / AWSLambdaJavaSnapStart

Different examples of solutions API Gateway->Lambda->DynamoDB with Lambda managed Java runtimes with different Lambda memory settings, compilation options, (a)synchronous HTTP clients, Lambda layers, GC algorithms and hardware architecture (x86 vs arm64) including Lambda SnapStart enabling and priming techniques to measure Lambda performance
https://dev.to/vkazulkin/measuring-java-11-lambda-cold-starts-with-snapstart-part-1-first-impressions-30a4
14 stars 2 forks source link
aws aws-lambda aws-snapstart coldstart java peformance serverless

Explore ways to use Java Runtimes with AWS Lambda with and without AWS Lambda SnapStart using different framewoks.

Architecture

Application Architecture

Project Description

The code example include storing and retrieving product from the Amazon DynamoDB. I put Amazon API Gateway in front of my Lambdas.

I made all the test for the following use cases:

I tested different impact of the Lambda cold and warm start of the following:

To the explored AWS Lambda Java Runtimes belong:

To the explore frameworks belong :

Installation and deployment


Clone git repository locally
git clone https://github.com/Vadym79/AWSLambdaJavaSnapStart.git

Compile and package the Java application with Maven from the root (where pom.xml is located) of the project
mvn clean package

Deploy your application with AWS SAM
sam deploy -g  

In order not to use AWS Lambda SnapStart comment both lines in the globals's section of the Lambda function.

Globals:
Function:

SnapStart:

   #ApplyOn: PublishedVersions   

In order to user AWS Lambda SnapStart uncomment both lines above. For different Priming optimizations enabling of SnapStart is required

Further Readings

You can read my article series AWS Lambda SnapStart