A developer is troubleshooting an AWS Lambda function that processes records from an Amazon Kinesis Data Stream. The function is configured with a batch size of 100 and a parallelization factor of 1. The developer notices that the iterator age is increasing, indicating that the function is not keeping up with the stream. CloudWatch Logs show that the function is not experiencing errors or throttling, but the execution time per invocation is close to the 5-minute timeout. The stream has 10 shards. Which action will most likely increase processing throughput?
Trap 1: Increase the batch size to 500.
If the function is already close to timeout with a batch size of 100, increasing the batch size will likely cause it to timeout more often, worsening throughput.
Trap 2: Increase the parallelization factor to 10.
While this allows up to 100 concurrent invocations, each invocation still takes near 5 minutes. The total records processed per second may not increase significantly if each batch takes the same time.
Trap 3: Split the stream into more shards.
Adding more shards increases the number of concurrent Lambda invocations, but each invocation still processes slowly. The throughput per shard remains low, so the overall throughput may not improve enough.
- A
Increase the batch size to 500.
Why wrong: If the function is already close to timeout with a batch size of 100, increasing the batch size will likely cause it to timeout more often, worsening throughput.
- B
Increase the parallelization factor to 10.
Why wrong: While this allows up to 100 concurrent invocations, each invocation still takes near 5 minutes. The total records processed per second may not increase significantly if each batch takes the same time.
- C
Increase the Lambda function memory and CPU allocation.
Increasing memory increases CPU allocation proportionally, which can make each invocation faster. This reduces the per-batch processing time, allowing the function to keep up with the stream and decrease the iterator age.
- D
Split the stream into more shards.
Why wrong: Adding more shards increases the number of concurrent Lambda invocations, but each invocation still processes slowly. The throughput per shard remains low, so the overall throughput may not improve enough.