ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 64 - DVA-C01 discussion

Report
Export

A Developer has implemented a Lambda function that needs to add new customers to an RDS database that is expected to run hundreds of times per hour. The Lambda function is configured to use 512MB of RAM and is based on the following pseudo code:

After testing the Lambda function, the Developer notices that the Lambda execution time is much longer than expected. What should the Developer do to improve performance?

A.
Increase the amount of RAM allocated to the Lambda function, which will increase the number of threads the Lambda can use.
Answers
A.
Increase the amount of RAM allocated to the Lambda function, which will increase the number of threads the Lambda can use.
B.
Increase the size of the RDS database to allow for an increased number of database connections each hour.
Answers
B.
Increase the size of the RDS database to allow for an increased number of database connections each hour.
C.
Move the database connection and close statement out of the handler. Place the connection in the global space.
Answers
C.
Move the database connection and close statement out of the handler. Place the connection in the global space.
D.
Replace RDS wit Amazon DynamoDB to implement control over the number of writes per second.
Answers
D.
Replace RDS wit Amazon DynamoDB to implement control over the number of writes per second.
Suggested answer: C

Explanation:

Refer AWS documentation - Lambda Best Practices

Take advantage of Execution Context reuse to improve the performance of your function. Make sure any externalized configuration or dependencies that your code retrieves are stored and referenced locally after initial execution. Limit the re-initialization of variables/objects on every invocation.

Instead use static initialization/constructor, global/static variables and singletons. Keep alive and reuse connections (HTTP, database, etc.) that were established during a previous invocation.

asked 16/09/2024
Ronald Armas
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first