News
AWS Introduces Lambda SnapStart for Java
- By John K. Waters
- November 29, 2022
AWS this week unveiled a new performance optimization feature called Lambda SnapStart, which is designed to improve startup times for latency-sensitive applications.
Announced at AWS re:Invent 2022, underway this week in Las Vegas, the first version of this new feature is aimed at Java developers—thus the name, Lambda SnapStart for Java. Because Java is a dynamic language with its own runtime and garbage collector, Lambda functions written in Java can be quite slow to initialize. For apps that require frequent scaling, this delay introduced by initialization, known as a "cold start," can impact the user experience negatively.
SnapStart solves the cold start problem, explained AWS Chief Evangelist Jeff Barr, in a blog post, by initializing the function’s code ahead of time, taking a snapshot of the initialized execution environment, and caching it. When the function is invoked and subsequently scales up, Lambda SnapStart resumes new execution environments from the cached snapshot instead of initializing them from scratch, significantly improving startup latency.
AWS claims SnapStart delivers up to 10x faster function startup times with minimal or no code changes, making it much easier for Java developers to build highly responsive and scalable Java apps using the AWS Lambda serverless compute service.
Lambda SnapStart for Java, which supports the Java 11 runtime, delivers improved startup times, the company explains,
"We are launching with support for Java functions that make use of the Corretto 11 runtime (AWS's distribution of OpenJDK), and expect to see Lambda SnapStart put to use right away for applications that make use of Spring Boot, Quarkus, Micronaut, and other Java frameworks," Barr said.
In another blog post, the company explained the capability this way:
With SnapStart, the function’s initialization is done ahead of time when you publish a function version. Lambda takes a Firecracker microVM snapshot of the memory and disk state of the initialized execution environment, encrypts the snapshot, and caches it for low-latency access. When your application starts up and scales to handle traffic, Lambda resumes new execution environments from the cached snapshot instead of initializing them from scratch, improving startup performance.
A microVM (micro virtual machine) is a virtual machine program that serves to isolate an untrusted computing operation from a computer's host operating system. Firecracker is an open-source virtual machine monitor (VMM) that uses the Linux Kernel-based Virtual Machine (KVM).
"For latency sensitive applications where you want to support unpredictable bursts of traffic, high and outlier startup latencies (known as cold starts) can cause delays in your users’ experience," the company says. "Lambda SnapStart is ideal for applications such as synchronous APIs, interactive microservices, or data processing."
Lambda SnapStart is generally available in several AWS Regions, including US East (Ohio), US East (N. Virginia), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Tokyo), Asia Pacific (Sydney), Europe (Frankfurt), Europe (Ireland), and Europe (Stockholm).
Lambda SnapStart can be activated for new or existing Java-based Lambda functions running on Amazon Corretto 11, using the AWS Lambda API, AWS Management Console, AWS Command Line Interface (AWS CLI), AWS Cloud Formation, AWS Serverless Application Model (AWS SAM), AWS SDK, and the AWS Cloud Development Kit (AWS CDK).
About the Author
John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS. He can be reached at [email protected].