There are two approaches of "deploying" a Java Lambda:
As it takes really long until the environment that executes our simple Lambda is "booted" (20-30s), I wonder if either approach is "faster" than the other or can be further speed up?
You can run Java code in AWS Lambda. Lambda provides runtimes for Java that run your code to process events. Your code runs in an Amazon Linux environment that includes AWS credentials from an AWS Identity and Access Management (IAM) role that you manage. Lambda supports the following Java runtimes.
To deploy your function's code, you upload the deployment package from Amazon Simple Storage Service (Amazon S3) or your local machine. You can upload a . zip file as your deployment package using the Lambda console, AWS Command Line Interface (AWS CLI), or to an Amazon Simple Storage Service (Amazon S3) bucket.
I have found that the FAT jar is the optimal approach for lambdas with a footprint smaller than the MB limit. If you are over the MB limit, add the libraries to the lambda's lib folder and read them in.
With jars in the lib, I have found is that the lambda loads a little slower when it launches the first time in a container... the first time it is slower, subsequent launches in the same container are very fast... if it goes to a new container, one-time slow again.
Here is some good info on those cold starts: https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With