Lambda Snapstart : Accelerate AWS Lambda Function

Lambda Snapstart : Accelerate AWS Lambda Function

November 30, 2022 / Nirav S

When the Lambda service receives a request to run a function, the service first prepares an execution environment. During this step, the service downloads the code for the function, which is stored in an internal S3 bucket (or in Amazon ECR if the function uses container packaging). It then creates an environment with the memory, runtime, and configuration specified. Once complete, Lambda runs any initialization code outside of the event handler before finally running the handler code.

Download the code & start a new execution environment are frequently referred to as a “cold start”. You are not charged for the time it takes for Lambda to prepare the function but it does add latency to the overall invocation duration.

Introduction of Lambda SnapStart

Cold start times have long been one of the biggest complaints about Lambda.

Functions using Java runtimes typically experience significantly longer initialization times than functions using other runtimes. SnapStart for Java reduces startup latency for Java-based functions running on AWS Lambda.

Today, AWS announced a new feature called SnapStart for Lambda.

This new feature is now available on the platform, though it has to be enabled for existing Lambda functions, and for now, it only works for Java functions that make use of the Corretto runtime.

SnapStart aims to speed up the cold start times of applications through the use of snapshots that can run multiple execution environments.

Once enabled, when you first run that function, it will perform a standard initialization. After that, it will create an encrypted snapshot of the memory and disk state, and cache for reuse. Then, when the function is invoked again, Lambda will grab the cache and start up the function. AWS Lambda further improves invoke times by dividing snapshots into chunks. This means only the chunks required for your function are downloaded from a distributed cache on invoke. In real terms, this process removes several seconds of latency from function execution and scaling times. Cached snapshots are removed after 14 days of inactivity.

Talk to AWS Certified Consultant

    Let Us Talk About Your AWS Development Requirements

    Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project