Cookie Consent by Free Privacy Policy Generator 📌 AWS SnapStart - Part 19 Measuring cold starts and deployment time with Java 17 using different Lambda memory settings


✅ AWS SnapStart - Part 19 Measuring cold starts and deployment time with Java 17 using different Lambda memory settings


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

Introduction

In the Part 12 of our series we measured the cold starts of the Lambda function with Corretto Java 21 runtime without SnapStart enabled, with SnapStart enabled and also applied DynamoDB invocation priming optimization with different Lambda function memory settings . In this article we’d like to do the same measurement but for Corretto Java 17 runtime and then do comparison between both.

Measuring cold starts with Java 17 with and without SnapStart enabled using different Lambda memory settings.

In our experiment we'll re-use the application introduced in part 8 for this. Here is the code for the sample application. There are basically 2 Lambda functions which both respond to the API Gateway requests and retrieve product by id received from the Api Gateway from DynamoDB. One Lambda function GetProductByIdWithPureJava17Lambda can be used with and without SnapStart and the second one GetProductByIdWithPureJava17LambdaAndPriming uses SnapStart and DynamoDB request invocation priming. We'll measure cold starts using the following memory settings in MBs : 256, 512, 768, 1024, 1536 and 2048.

The results of the experiment below were based on reproducing approximately 100 cold starts for the duration of our experiment which ran for approximately 1 hour. For it (and all experiments from my previous articles) I used the load test tool hey, but you can use whatever tool you want, like Serverless-artillery or Postman

Cold start time without SnapStart in ms:

Experiment description p50 p75 p90 p99 p99.9 max
256 MB cold start time w/o SnapStart 7309.66 7432.6 7575.51 7662.51 7782.25 7962.01
512 MB cold start time w/o SnapStart 4213.37 4256.07 4325.17 4496.15 4661.23 4786.71
768 MB cold start time w/o SnapStart 3310.08 3414.9 3551.82 4271.48 4421.09 4594.42
1024 MB cold start time w/o SnapStart 2880.53 2918.79 2974.45 3337.29 3515.86 3651.65
1536 MB cold start time w/o SnapStart 2390.15 2434.52 2464.46 2668.95 2812.15 2987.04
2048 MB cold start time w/o SnapStart 2198.02 2272.5 2397.97 2757.06 2892.65 3005.31

Cold start time with SnapStart without Priming in ms :

Experiment description p50 p75 p90 p99 p99.9 max
256 MB cold start time with SnapStart w/o Priming 4972.83 5227.66 5754.12 7551.76 7559.31 7562.5
512 MB cold start time with SnapStart w/o Priming 2550.59 2604.69 2765.67 2942.48 3108.76 3110.69
768 MB cold start time with SnapStart w/o Priming 1801.28 1887.92 2251.03 2604.69 2681.29 2681.34
1024 MB cold start time with SnapStart w/o Priming 1521.33 1578.64 1918.35 2113.65 2115.77 2117.42
1536 MB cold start time with SnapStart w/o Priming 1204.06 1325.32 1507.70 1817.56 1821.19 1821.6
2048 MB cold start time with SnapStart w/o Priming 1129.45 1286.17 1583.38 1819.37 1998.60 2000.17

Cold start time with SnapStart enabled and with DynamoDB invocation Priming in ms :

Experiment description p50 p75 p90 p99 p99.9 max
256 MB cold start time with SnapStart w/o Priming 1126.07 1183.77 1397.42 1608.90 1621.82 1622.23
512 MB cold start time with SnapStart with Priming 831.84 881.49 1136.24 1348.03 1386.29 1387.52
768 MB cold start time with SnapStart with Priming 819.46 891.23 1141.93 1243.19 1808.50 1809.34
1024 MB cold start time with SnapStart with Priming 692.79 758.00 1003.80 1204.06 1216.15 1216.88
1536 MB cold start time with SnapStart with Priming 713.17 773.31 995.80 1124.94 1372.50 1372.73
2048 MB cold start time with SnapStart with Priming 797.64 858.87 1080.86 1296.49 1376.62 1377.05

I also measured the deployment time of such sample project with all memory settings mentioned above with SnapStart enabled for all functions and GetProductByIdWithPureJava17LambdaAndPriming function additionally using priming. Here are the results:

Experiment description average deployment time in minutes/seconds
256 MB deployment time with SnapStart 2m 57 s
512 MB deployment time with SnapStart 2m 19 s
768 MB deployment time with SnapStart 2m 04 s
1024 MB deployment time with SnapStart 2m 10 s
1536 MB deployment time with SnapStart 2m 12 s
2048 MB deployment time with SnapStart 2m 13 s

Conclusions

In this article we measured the cold start time of the Lambda function without SnapStart with SnapStart and for the latter with additional priming of DynamoDB invocation for Java 17 runtime.

In case of not enabling SnapStart we observed that increasing the memory from 256 MB to 2048 MB constantly brought significant reduction of the cold start time. We observed the same with Java 21 runtime, but cold start times with Java 17 runtime being a bit lower than with Java 21 runtime (for the relative early version of Java 21 used for the measurements)

In case of enabling SnapStart but not using priming we observed that increasing the from 256 MB to 1536 MB brought significant reduction of the cold start time with very low impact of increasing the memory from 1536 MB or even to 2048 MB. We observed similar with Java 21 runtime, but the impact of increasing memory even beyond 1024 MB already became lower. but cold start times with Java 17 runtime being a bit lower than with Java 21 runtime (for the relative early version of Java 21 used for the measurements)

In case of enabling SnapStart and with additional priming of DynamoDB invocation we observed that increasing the from 256 MB to 1024 MB brought significant reduction of the cold start time but after that the impact of increasing the memory to 1536 MB or 2048 MB was low or even negative for all percentiles. We observed the same with Java 21 runtime. Also the result of using Java 17 and Java 21 runtimes are very close.

So for the SnapStart-enabled Lambda function and considering our use case with Lambda function reading from the DynamoDB table the Lambda memory setting of 1024 MB is a good choice.

Deployment time for the SnapStart enabled on all 3 Lambda functions and additionally applying priming on one of them also became lower by giving the Lambda function more memory but only until 786 MB. After that we even observed the small increase of the deployment time. With Java 21 runtime we observed decrease of the deployment time by giving the Lambda function more memory until 1024 MB and then relative stable deployment time by giving Lambda function even more memory.

...

✅ Reducing Cold Starts on AWS Lambda with Java Runtime - Future Ideas about SnapStart, GraalVM and Co


📈 74.11 Punkte

✅ How to save costs using AWS Lambda SnapStart for Java based functions


📈 55.67 Punkte

✅ Reducing AWS Lambda Cold Starts


📈 41.45 Punkte

✅ Introducing Lambda SnapStart


📈 38.41 Punkte

✅ Get started quickly with AWS Trainium and AWS Inferentia using AWS Neuron DLAMI and AWS Neuron DLC


📈 34.38 Punkte

✅ Different approaches to reduce AWS S3 file upload time using AWS-SDK v3 in NodeJS.


📈 33.92 Punkte

✅ AWS Lambda support Node.js 18 now. Should we update the version of Node.js in the Lambda runtime?


📈 33.26 Punkte

✅ How to optimize your lambda functions with AWS Lambda power tuning


📈 33.26 Punkte

✅ Supercharge Your AWS Lambda Game With Lambda Powertools


📈 33.26 Punkte

✅ Lambda Internals: Why AWS Lambda Will Not Help With Machine Learning


📈 33.26 Punkte

✅ Turbocharge your Lambda Functions with AWS Lambda Powertools for Python


📈 33.26 Punkte

✅ Real-Time Stream Processing with AWS Lambda and Kinesis: Building Real-Time Analytics Pipelines


📈 32.89 Punkte

✅ Connecting AWS Lambda with Amazon RDS using AWS CDK and Node.js


📈 32.74 Punkte

✅ Deploy nest app to AWS Lambda using cloud-formation stack and AWS CDK


📈 32.74 Punkte

✅ Understanding and Solving the AWS Lambda Cold Start Problem


📈 32.47 Punkte

✅ A tale of invocation - Using AWS Lambda to transfer files from AWS S3 to Azure Blob Storage


📈 31.22 Punkte

✅ Serverless Application using AWS Lambda ,Api Gateway,AWS Amplify


📈 31.22 Punkte

✅ Serverless Application using AWS Lambda ,Api Gateway,AWS Amplify


📈 31.22 Punkte

✅ Cold Start Challenge in AWS Lambda Functions


📈 30.96 Punkte

✅ 🦁 NestJS on AWS Lambda: The Ultimate CDK Deployment Strategy for Monolithic APIs


📈 30.92 Punkte

✅ This Mac app lets you link different Dock settings to different display setups


📈 29.82 Punkte

✅ Building an AI powered and Serverless meal planner with OpenAI, AWS Step functions, AWS Lambda and CDK


📈 29.72 Punkte

✅ Deploy Your First Web App on AWS with AWS Amplify, Lambda, DynamoDB and API Gateway


📈 28.2 Punkte

✅ Creating a serverless API using AWS Lambda and Node.js with TypeScript and Express.js


📈 27.55 Punkte

✅ Understanding and Using Lambda Functions in Python and Java


📈 26.86 Punkte

✅ AWS Inspector for AWS Lambda


📈 26.69 Punkte

✅ Build AWS Lambda Layers with AWS CDK


📈 26.69 Punkte

✅ Hacking AWS Account via AWS Lambda SSRF


📈 26.69 Punkte

✅ AWS ECS vs. AWS Lambda: Top 5 Main Differences


📈 26.69 Punkte

✅ Applying event filters to AWS Lambda Functions with the AWS CDK


📈 26.69 Punkte

✅ Learning AWS Day by Day — Day 45 — AWS Lambda


📈 26.69 Punkte











matomo

Datei nicht gefunden!