Apache Storm Tumbling 中的过期元组 Window

Expired Tuples in Apache Storm Tumbling Window

我实现了大小为 100 的 Tumbling Window(基于计数)。在 运行 拓扑上,我看到新元组的计数 (inputWindow.get) 和计数过期的元组 (inputWindow.getExpired) 均为 100。我已将消息时间设置为 600 秒。有了这次超时,我原以为没有元组会过期。元组过期的原因可能是什么? 我已将螺栓设置为 bolt.withTumblingWindow(Count.of(100)) 螺栓有 parallelism_hint 的 120

builder.setBolt("bolt", bolt.withTumblingWindow(Count.of(100)), 120).shuffleGrouping("spout")

我想您可能误解了过期的元组是什么。也许叫他们 "evicted tuples".

会更友好

它们是已从当前 window 中逐出但存在于最后 window 中的元组。它们不是消息超时已过期的元组,尽管从这个意义上讲它们当然也可能已过期。

假设您收到 200 个元组。您首先 window 将是元组 0-99,没有过期的元组。您的第二个 window 将是元组 100-199,其中元组 0-99 已过期。

这个有用的原因是在滑动 windows 的情况下,其中 windows 不相交。在那种情况下,您可能会得到例如a window 即 0-99,然后是 50-149,然后是 99-199。如果您被告知 "tuples 0-49 are no longer in the window" 而不是必须自己计算,那么它会很有帮助。

有关这方面的更多信息,请查看 class controlling windows at https://github.com/apache/storm/blob/925422a5b5ad1c3329a2c2b44db460ae94f70806/storm-client/src/jvm/org/apache/storm/windowing/WindowManager.java