A developer deployed a new version of an AWS Lambda function that is part of a serverless application. The function uses an Amazon DynamoDB table as a data store. After deployment, the developer notices that the function's latency has increased significantly for some requests. CloudWatch traces show that the increase is due to DynamoDB throttle events. The function is configured with a reserved concurrency of 100 and the DynamoDB table has 5 read capacity units (RCUs) and 5 write capacity units (WCUs). What is the most effective way to reduce the throttling while maintaining application performance?
Trap 1: Decrease the reserved concurrency of the Lambda function to 10
Reducing concurrency limits the number of concurrent executions but does not increase the capacity of the DynamoDB table, so throttling may still occur with fewer but still load-intensive requests.
Trap 2: Enable DynamoDB Accelerator (DAX) for caching reads
DAX only caches reads, not writes, and does not address write throttling. Also, it adds complexity.
Trap 3: Enable auto scaling on the DynamoDB table
Auto scaling adjusts capacity over time but requires a starting point; with only 5 units, it may not react fast enough to sudden spikes. Manual increase is more immediate.
- A
Decrease the reserved concurrency of the Lambda function to 10
Why wrong: Reducing concurrency limits the number of concurrent executions but does not increase the capacity of the DynamoDB table, so throttling may still occur with fewer but still load-intensive requests.
- B
Increase the read and write capacity units on the DynamoDB table
Increasing RCU and WCU directly increases the number of operations the table can handle, reducing throttling.
- C
Enable DynamoDB Accelerator (DAX) for caching reads
Why wrong: DAX only caches reads, not writes, and does not address write throttling. Also, it adds complexity.
- D
Enable auto scaling on the DynamoDB table
Why wrong: Auto scaling adjusts capacity over time but requires a starting point; with only 5 units, it may not react fast enough to sudden spikes. Manual increase is more immediate.