Topic 1 Question 507
A developer has implemented an AWS Lambda function that inserts new customers into an Amazon RDS database. The function is expected to run hundreds of times each hour. The function and RDS database are in the same VPC. The function is configured to use 512 MB of RAM and is based on the following pseudo code:
After successfully testing the function multiple times, the developer notices that the execution time is longer than expected.
What should the developer do to improve performance?
Increase the reserved concurrency of the Lambda function.
Increase the size of the RDS database to facilitate an increased number of database connections each hour.
Move the database connection and close statement out of the handler. Place the connection in the global space.
Replace Amazon RDS with Amazon DynamoDB to implement control over the number of writes per second.
ユーザの投票
コメント(3)
- 正解だと思う選択肢: C
The best answer is C: Move the database connection and close statement out of the handler. Place the connection in the global space. This solution would:
Create the connection once when the Lambda container initializes Reuse that same connection across multiple invocations Significantly reduce the overhead of establishing new connections Improve execution time and resource usage Follow AWS best practices for Lambda-RDS connections
👍 2LingZ2025/02/21 - 正解だと思う選択肢: A
Reserved concurrency defines the maximum number of concurrent executions for a Lambda function. If the function is expected to run hundreds of times each hour, it could be hitting concurrency limits, causing delays due to Lambda being throttled, which would lead to longer execution times.
👍 1e8868352025/02/06 - 正解だと思う選択肢: C
connection to database as global variable outside the handler
👍 10bdf3af2025/03/03
シャッフルモード