A Developer is working on a serverless project based in Java. Initial testing shows a cold start takes about 8 seconds on average for AWS Lambda functions. What should the Developer do to reduce the cold start time? (Choose two.)
A.
Add the Spring Framework to the project and enable dependency injection.
B.
Reduce the deployment package by including only needed modules from the AWS SDK for Java.
C.
Increase the memory allocation setting for the Lambda function.
D.
Increase the timeout setting for the Lambda function.
E.
Change the Lambda invocation mode from synchronous to asynchronous.
Difficult question as it is planned...
A: This does not reduce start up time (in fact it can aggravate the problem)
B: This is true only if the question assumes that the Java code is using AWS SDK (not remarked).
C. This is true as increasing the memory will increase the assigned CPU and will reduce the start up time
D. This can mitigate the problem but it doesn´t reduce the start up time as requested.
E. This can mitigate the problem but it doesn´t reduce the start up as requested.
So for me I go for B & C
IMO your justification for E in incorrect. It will solve the cold start problem. Check https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot#asynchronous-initialization. Answer is BE in my opinion
hi, the link you provided says :
1- return control back to AWS Lambda just before the 10 seconds timeout expires.
2- By default, Serverless Java Container will wait for an additional 10 seconds.
Taking advantage of asynchronous-init depends on treshold 10 sec but question says 8 sec , before timeout. Although E option sounds making much more sense than B , just confused with 8 sec vs 10 sec
B & C
Ref: https://hackernoon.com/im-afraid-you-re-thinking-about-aws-lambda-cold-starts-all-wrong-7d907f278a4f
"...Alternatively, you could consider reducing the impact of cold starts by reducing the length of cold starts: by authoring your Lambda functions in a language that doesn’t incur a high cold start time — i.e. Node.js, Python, or Go.
Choose a higher memory setting for functions on the critical path of handling user requests (i.e. anything that the user would have to wait for a response from, including intermediate APIs)
Optimizing your function’s dependencies, and package size..."
B) Correct - Larger deployment packages can increase the cold start time because Lambda must load and initialize all the code and dependencies.Reducing the size of the deployment package can significantly reduce initialization time. In particular, only include the parts of the AWS SDK for Java that are required for the Lambda function, instead of including the entire SDK.
C) Correct - AWS Lambda allocates CPU power based on the memory allocation you set for your function. Increasing the memory allocation provides more CPU power, which can improve the cold start time.
By procceeding with elimination,
A- increases cold start time as SpringFramework is a big dependency and it is not mentioned the java app is using spring!
D- Lambda timeout doesnt decrease cold start time
E- Invocation mode doesnt decrease cold start time
so by eliminating these two we have
B- true if java is already using aws sdk
C- true because increasing RAM with AWS is proportionate with CPU => more CPU less cold start time
A - Spring framework dependency injection has nothing to do with start up time.
B- This could help by easing the start up process
C- Provisioning more memory might help with the start-up
D- Nothing to do with cold start
E- I don't think this can mitigate a cold start problem
B. Reduce the deployment package size by including only the needed modules from the AWS SDK for Java. Cold starts can be slow when a large deployment package is involved because it takes time to load and initialize all the resources. By reducing the package size, you can decrease the initialization time.
C. Increase the memory allocation setting for the Lambda function: Increasing the memory allocated to a Lambda function also increases its CPU power and network bandwidth. Lambda functions with more memory tend to initialize faster because they have more resources available for execution. A side effect of this is that it can improve cold start times.
By exclusion I would say B and C. If we use the SDK, we do have only include the liraries that we really need. Furthemore, if we increase the memory to the lambda function, also the CPU will be increased and we can observe a significant increase of the performance
The answer is BE
Justification for E:
https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot#asynchronous-initialization. Answer is BE in my opinion
Spring has onApplicationEvent method which maybe used to warmup the environment. But the real solution should be Provisioned Concurrency. See "Reducing cold starts with Provisioned Concurrency" from https://aws.amazon.com/blogs/compute/operating-lambda-performance-optimization-part-1/
B & C
A: This does not reduce start up time (in fact it can aggravate the problem)
B: This is true only if the question assumes that the Java code is using AWS SDK (not remarked).
C. This is true as increasing the memory will increase the assigned CPU and will reduce the start up time
D. This can mitigate the problem but it doesn´t reduce the start up time as requested.
E. This can mitigate the problem but it doesn´t reduce the start up as requested.
So for me I go for B & C
IMO your justification for E in incorrect. It will solve the cold start problem. Check https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot#asynchronous-initialization. Answer is BE in my opinion
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ipindado2020
Highly Voted 3 years, 6 months agocaptainpike
2 years, 1 month agoborisgor
2 years agoNoCrapEva
Highly Voted 3 years, 6 months agosumanshu
Most Recent 4 months, 1 week agosumanshu
4 months, 1 week agosumanshu
4 months, 1 week agoBaalhammun
1 year, 2 months agoSD_CS
1 year, 2 months agoTeemo2023
1 year, 4 months agosara_exam_topics
1 year, 6 months agorcaliandro
1 year, 10 months agocaptainpike
2 years, 1 month agopancman
2 years, 1 month agosuru003
1 year, 12 months agogpit
2 years, 5 months agojuaneks
2 years, 9 months agoidqc
3 years, 1 month agoNitin_Ramnani
3 years, 2 months agocaptainpike
2 years, 1 month agoJP_PA
3 years, 2 months agoranga_reddy
3 years, 3 months agodark_cherrymon
2 years, 5 months agoranga_reddy
3 years, 3 months ago