DynamoDB流的滚动窗口 – 这是否只会使用一个Lambda函数?

huangapple go评论71阅读模式
英文:

DynamoDB stream's tumbling window - Will there be only a single Lambda function used for this?

问题

关于tumbling window concept的部分翻译如下:

"这个新特性引入了滚动窗口的概念,它是一个固定大小的、不重叠的时间间隔,最长可达15分钟。要使用这个功能,您需要在流与Lambda函数之间的事件源映射中指定滚动窗口的持续时间。当您将滚动窗口应用于流时,流中的项目将根据窗口分组,并发送到处理Lambda函数。该函数返回一个状态值,该状态值将传递给下一个滚动窗口的调用。"

读完这段内容后,我理解我们可以在一段时间内聚合DynamoDB流的更新,然后由Lambda函数以批量方式消耗(另请参阅:使用滚动窗口进行分析 :: 我的AWS工作坊)。

现在,如果我不使用这个概念,那么对于每个行更新,如果更新足够接近,就会创建不同的Lambda实例。

但在这种情况下,我不确定是否会有多个Lambda实例同时处理DynamoDB流的更新。

想要确认是否会出现这种情况?我们需要相应地设计我们的服务。

英文:

For the tumbling window concept:
> This new feature introduces the concept of a tumbling window, which is a fixed-size, non-overlapping time interval of up to 15 minutes. To use this, you specify a tumbling window duration in the event-source mapping between the stream and the Lambda function. When you apply a tumbling window to a stream, items in the stream are grouped by window and sent to the processing Lambda function. The function returns a state value that is passed to the next invocation of the tumbling window.

After reading this, I understand that we can aggregate dynamo db stream updates for some time, which then would be consumed by a lambda in bulk (also see: Analytics with Tumbling Windows :: My AWS Workshop).

Now if I were to not use this concept, then for each row update, a different instance of lambda would have been created, if the updates were done close enough.

But in this case, I am not sure whether there would be any concept of multiple instances of lambdas working on dynamo db stream updates.

Wanted to confirm whether that would be the case? We need to design our service accordingly.

答案1

得分: 1

以下是翻译好的部分:

"当从 DynamoDB 流中读取时,始终会存在多个 Lambda 实例。这是由于 DynamoDB 分区、流分片以及 Lambda 容器之间的关系所致:"

"因此,对于 DynamoDB 表中的每个分区,您将拥有一个活动的分片,因此会触发一个 Lambda 调用。"

英文:

There will always be multiple instances of Lambda when reading from a DynamoDB Stream. This is due to the relationship between DynamoDB partitions and stream shards and the Lambda conatainers:

1 : 1 : 1
DynamoDB Partition : Stream Shard : Lambda Container

So for every partition in your DynamoDB table you will have an active shard and consequently a Lambda invocation.

huangapple
  • 本文由 发表于 2023年6月13日 17:30:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463482.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定