The service speeds up the cold start of Lambda virtual servers.
When a function isn’t used for a while, Lambda will shut a virtual machine down. It can then take a considerable amount of time for the Lambda virtual server to boot up. AWS says this occurs for several reasons.
First, initializing the runtime for some languages can be an extensive process. For example, the
Init phase for a Lambda function that uses one of the Java runtimes in conjunction with frameworks such as Spring Boot, Quarkus or Micronaut can take as long as ten seconds.
Second, the static code may download some machine learning models, pre-compute some reference data or establish network connections to other AWS services.
SnapStart addresses these issues by taking ‘snapshots’ of a customer’s Lambda functions and starting those up without having to go through the usual initialization process.
How it works
After a customer enables Lambda SnapStart for a particular Lambda function, publishing a new version of the function will trigger an optimization process. The process launches the user’s function and runs it through the entire
Init phase. Then SnapShot takes an immutable, encrypted snapshot of the memory and disk state and caches it for reuse.
When the function is subsequently invoked, the state is retrieved from the cache in chunks on an as-needed basis and used to populate the execution environment. This optimization makes invocations faster and more predictable, since creating a fresh execution environment no longer requires a dedicated
AWS is launching SnapShot with support for Java functions that make use of the Corretto (java11) runtime. The organization also expect Lambda SnapStart to be put to use right away for applications that make use of Spring Boot, Quarkus, Micronaut and other Java frameworks.
Enabling Lambda SnapStart for Java functions can make them boot up to 10 times faster, AWS claims. Best of all, this time-saving feature is available at no extra cost, the organization said.
Techzine is attending AWS re:Invent this week. Keep an eye on the website for more. You can find the most important news in this overview.