Soru

Zorluk: OrtaServerless Development with AWS Lambda

A developer has configured an Amazon DynamoDB table with DynamoDB Streams enabled to trigger an AWS Lambda function. The stream has a single active shard. During load testing, a high volume of database writes causes significant lag in stream processing because the Lambda function cannot keep up with the rate of incoming records. The developer needs to reduce the processing latency and resolve the lag while maintaining the order of processed records per partition key. Which configuration change will resolve the stream processing lag?

  1. A
    Increase the Lambda function's execution timeout to ensure the execution context remains warm and automatically processes all subsequent batches in the stream.
  2. Increase the Parallelization Factor in the event source mapping configuration to process multiple batches from the shard concurrently.Cevap
  3. C
    Increase the visibility timeout of the DynamoDB stream event source mapping to match the Lambda function's processing time.
  4. D
    Configure the Lambda function to run inside a private VPC subnet to access the DynamoDB stream endpoint via a gateway VPC endpoint.

Cevap

Increase the Parallelization Factor in the event source mapping configuration to process multiple batches from the shard concurrently.
The correct answer is to increase the Parallelization Factor in the event source mapping configuration. By default, Lambda processes only one batch per shard in parallel. Increasing the Parallelization Factor allows Lambda to poll and execute up to 10 concurrent batches from a single shard in parallel. Order is still guaranteed at the partition-key level, which satisfies all requirements of the scenario.

Adım Adım Çözüm

1
Analyze the bottleneck in stream processing where a single shard is experiencing processing lag due to high write volumes.
The default Lambda stream integration processes a maximum of one batch per shard in parallel, limiting throughput when the processing time of a single batch exceeds the arrival rate of new records.
Understanding the baseline concurrency behavior of Lambda event source mappings for stream sources is necessary to identify how to scale them.
2
Evaluate configuration properties on the Lambda event source mapping that control concurrency per shard.
The Parallelization Factor setting allows Lambda to process up to 10 concurrent batches from a single shard simultaneously.
This configuration allows scaling out horizontal processing of a stream shard without requiring database resharding.
3
Confirm that the solution meets the requirement to maintain in-order processing of records per partition key.
Lambda preserves in-order processing at the partition-key level even when the Parallelization Factor is greater than 1.
Ensuring data integrity and partition-key ordering is a strict requirement of the design scenario.

Anahtar Kavram

Scaling stream processing throughput in Lambda event source mappings using Parallelization Factor.
Tahmini Süre:1m 30s
Bu soruyu puanla