Learn how to diagnose and fix the issue of slow processing of records from a Kinesis data stream by an AWS Lambda function. Explore the best actions to take to increase the processing speed and reduce the iterator age metric.
Table of Contents
Question
A company is using an AWS Lambda function to process records from an Amazon Kinesis data stream. The company recently observed slow processing of the records. A developer notices that the iterator age metric for the function is increasing and that the Lambda run duration is constantly above normal.
Which actions should the developer take to increase the processing speed? (Choose two.)
A. Increase the number of shards of the Kinesis data stream.
B. Decrease the timeout of the Lambda function.
C. Increase the memory that is allocated to the Lambda function.
D. Decrease the number of shards of the Kinesis data stream.
E. Increase the timeout of the Lambda function.
Answer
A. Increase the number of shards of the Kinesis data stream.
C. Increase the memory that is allocated to the Lambda function.
Explanation
The correct answers are A. Increase the number of shards of the Kinesis data stream and C. Increase the memory that is allocated to the Lambda function.
These actions will increase the processing speed because they will increase the parallelism and performance of the Lambda function. The iterator age metric for a Lambda function measures the age of the last record for each batch of records processed by the function. A high iterator age indicates that the function is not processing records as fast as they are being produced by the Kinesis data stream. The Lambda run duration metric measures the amount of time that the function spends processing an event. A high run duration indicates that the function is taking longer to process each batch of records.
The developer can increase the number of shards of the Kinesis data stream to increase the parallelism of the Lambda function. A shard is a unit of throughput in a Kinesis data stream. Each shard can support up to 1,000 records per second for writes and up to 2 MB per second for reads. The number of shards determines how many concurrent invocations of the Lambda function can occur. By increasing the number of shards, the developer can increase the number of records that can be processed in parallel by the Lambda function.
The developer can also increase the memory that is allocated to the Lambda function to increase its performance. Lambda allocates CPU power and network bandwidth proportionally to the memory size. By increasing the memory size, the developer can increase the CPU power and network bandwidth available to the Lambda function, which can improve its processing speed and reduce its run duration.
The other options are not optimal because:
- Option B: Decreasing the timeout of the Lambda function will not increase the processing speed, but it may cause more errors and failures. The timeout setting determines how long Lambda allows a function to run before stopping it. If the timeout is reached, Lambda terminates the function and returns an error. By decreasing the timeout, the developer may cause more invocations to fail before they finish processing their batches of records, which will slow down the overall processing speed and increase the iterator age.
- Option D: Decreasing the number of shards of the Kinesis data stream will not increase the processing speed, but it may cause more throttling and backpressure. By decreasing the number of shards, the developer will decrease the throughput capacity and parallelism of the Kinesis data stream and the Lambda function. This may cause more records to accumulate in the stream and more invocations to be throttled by Lambda, which will slow down the processing speed and increase the iterator age.
- Option E: Increasing the timeout of the Lambda function will not increase the processing speed, but it may increase the cost and latency. By increasing the timeout, the developer will allow more invocations to run longer before they are stopped by Lambda. This may increase the cost of running the Lambda function, as Lambda charges based on both memory size and run duration. It may also increase the latency of processing each batch of records, as longer-running invocations will delay subsequent invocations.
Therefore, options A and C are the best actions for increasing the processing speed.
The latest AWS Certified Developer – Associate DVA-C02 certification actual real practice exam question and answer (Q&A) dumps are available free, which are helpful for you to pass the AWS Certified Developer – Associate DVA-C02 exam and earn AWS Certified Developer – Associate DVA-C02 certification.