r/java • • Nov 29 '22

Amazon Announces AWS Lambda SnapStart With Java Support

AWS Lambda now has a snapshotting feature that enables fast-start - essentially running the Init phase at publication time and saving the state of the process at that time, so it doesn't need to be re-run at every invocation.

https://aws.amazon.com/blogs/aws/new-accelerate-your-lambda-functions-with-lambda-snapstart/

It only works with Corretto on Java 11 right now, and is similar in intent to the CRIU technology.

Quarkus already has support for it: https://quarkus.io/blog/quarkus-support-for-aws-lambda-snapstart/

Other frameworks may also have support (but this work was done under NDA so I don't have links for them).

176 Upvotes

62 comments sorted by

View all comments

-2

u/Specialist_Bee_9726 Nov 29 '22

Who writes lambda functions in Java?

1

u/Specialist_Bee_9726 Nov 30 '22

I like how I get downvoted for simply stating the obvious that java is not well suited for short lived processes like lamdas. Just to make the response time bareable aws runs a JVM that dynamically loads classes leading to so much trouble (like having to deal with shadow jars).

The fact that it is suported lang and there a few instances where its used doesn't make it a good choice.

1

u/user_of_the_week Dec 05 '22

Lambda functions (or better said their environments) are not necessarily that short lived and also many applications don't care about a bit of latency.

For example, I have a bunch of "Lambdas" (actually Azure Functions, but that doesn't matter) that get triggered by a queue. Every few hours a new pack of messages arrives, the environment gets spun up in the background and then a bunch invocations of the function happen. 99% of the runs are "warm" with the environment already there.

We even use spring-cloud-function with the full Spring Boot magic so it takes about 3 seconds to spin up on a cold run. But it doesn't matter.