The answer to this question is not so simple and depends on multiple factors, here being a subset:
Lambda Event Source Mapping
To connect a Lambda trigger to a DynamoDB stream you need to use an Event Source Mapping (ESM). The ESM polls the DynamoDB stream every 250ms for more events, reading the amounts of items you've defined for BatchSize
.
Lambda Timing
Lambdas processing time also plays a role, if you have a function that has a long duration this will result in a higher iterator age, which in turn will appear like the stream is slower.
DynamoDB Stream Shard Rollover
DynamoDBs stream shards roll over every 4 hours, meaning it marks the current shard as read only, while opening a new shard available for writes. This results in the ESM having to do a shard discovery and can also seems like a spike in latency, though short lived.
Poisioned Pill
When you configure and ESM, the number of retires is set to -1
by default. This means that in the event of an error, the Lambda will continually retry the failed event, until that event succeeds or is no longer visible, which is 24hrs (retention period of streams). When this occurs, any item written to that partition is blocked for 24 hours. It's important to ensure you define the retries of the ESM to be anything other than -1
.