DynamoDB 触发器(Streams + Lambda):关于 TRIM_HORIZON 的详细信息?
DynamoDB Triggers (Streams + Lambda) : details on TRIM_HORIZON?
我想在 DynamoDB table 上处理最近的更新并将它们保存在另一个数据库中。假设我从 IoT 设备不规则地放入表 1 中获取更新,我需要使用 N 个最后更新来计算表 2 中与原始更新同步的同一设备的更新(一种滑动 window) .
DynamoDB Triggers (Streams + Lambda) 貌似挺适合我的需求,但是没找到明确的定义TRIM_HORIZON
。在一些文档中,我了解到它是 Table1 中最旧的数据(可能会变得很大),但在其他文档中,它似乎是 24 小时。或者也许是流中最旧的,即 24 小时?
所以有人知道 TRIM_HORIZON
的真相吗?甚至可以配置它吗?
我看到的替代方案是不使用 TRIM_HORIZON
,而是使用 LATEST
并在 Table1 上执行查询。但这有点违背了流的目的。
以下是 DynamoDB 文档 (1 and 2) 中适合您的相关方面:
All data in DynamoDB Streams is subject to a 24 hour lifetime. You can
retrieve and analyze the last 24 hours of activity for any given table
TRIM_HORIZON - Start reading at the last (untrimmed) stream record,
which is the oldest record in the shard. In DynamoDB Streams, there is
a 24 hour limit on data retention. Stream records whose age exceeds
this limit are subject to removal (trimming) from the stream.
因此,如果您有一个持续处理流更新的 Lambda,我建议您使用 LATEST
。
此外,由于您 "need to use the N last updates to compute an update in Table2",您必须为每个更新查询 Table1,以便您可以 'merge' 当前更新与该设备的先前更新。我不认为你也不能使用 TRIM_HORIZON
来解决这个问题。
我想在 DynamoDB table 上处理最近的更新并将它们保存在另一个数据库中。假设我从 IoT 设备不规则地放入表 1 中获取更新,我需要使用 N 个最后更新来计算表 2 中与原始更新同步的同一设备的更新(一种滑动 window) .
DynamoDB Triggers (Streams + Lambda) 貌似挺适合我的需求,但是没找到明确的定义TRIM_HORIZON
。在一些文档中,我了解到它是 Table1 中最旧的数据(可能会变得很大),但在其他文档中,它似乎是 24 小时。或者也许是流中最旧的,即 24 小时?
所以有人知道 TRIM_HORIZON
的真相吗?甚至可以配置它吗?
我看到的替代方案是不使用 TRIM_HORIZON
,而是使用 LATEST
并在 Table1 上执行查询。但这有点违背了流的目的。
以下是 DynamoDB 文档 (1 and 2) 中适合您的相关方面:
All data in DynamoDB Streams is subject to a 24 hour lifetime. You can retrieve and analyze the last 24 hours of activity for any given table
TRIM_HORIZON - Start reading at the last (untrimmed) stream record, which is the oldest record in the shard. In DynamoDB Streams, there is a 24 hour limit on data retention. Stream records whose age exceeds this limit are subject to removal (trimming) from the stream.
因此,如果您有一个持续处理流更新的 Lambda,我建议您使用 LATEST
。
此外,由于您 "need to use the N last updates to compute an update in Table2",您必须为每个更新查询 Table1,以便您可以 'merge' 当前更新与该设备的先前更新。我不认为你也不能使用 TRIM_HORIZON
来解决这个问题。