简体   繁体   English

Storm中的延迟队列/消息处理

[英]Delayed queue / message processing in Storm

In my Storm topology, while processing a stream, I want to delay the processing of some messages until some future points in time. 在我的Storm拓扑中,在处理流时,我想延迟处理某些消息,直到将来某些时间点。 What are some reasonable options for doing this? 这样做的合理选择是什么?

So far, I have thought about the following: 到目前为止,我已经考虑过以下几点:

  • Using Java's Thread.sleep . 使用Java的Thread.sleep (However, based on some discussions, this is not a recommended way to efficiently utilize Storm's resources.) (但是,根据一些讨论,这不是有效利用Storm资源的推荐方法。)
  • Use a delayed queue... 使用延迟队列......
  • Does Storm have some API for delaying a message that I have overlooked? Storm是否有一些API来延迟我忽略的消息?
  • Does ZeroMQ provide a delayed messaging API that Storm (if modified) could take advantage of? ZeroMQ是否提供Storm(如果已修改)可以利用的延迟消息传递API?

We are using topology tick tuples to process pending tuples in bulk. 我们使用拓扑结构元组来批量处理挂起的元组。 It basically just stores them in memory on every normal tuple and when it receives a tick tuple it processes them into storage/indexing using bulk/pipelined processing. 它基本上只是将它们存储在每个正常元组的内存中,当它收到一个tick元组时,它使用批量/流水线处理将它们处理成存储/索引。

We also use redis in cases where we have enormous spikes in volume, if a volume spike detected all tuples redirect to local redis storage on each of the hosts and then get pushed back into topology processing after volume dies down. 如果卷的峰值检测到所有元组都重定向到每个主机上的本地redis存储,然后在卷停止后被推回拓扑处理,我们也会在数量激增的情况下使用redis。 Our situation might not be applicable to yours, just my 2c. 我们的情况可能不适用于你的,只是我的2c。

Use an external message queue to implement a time-delay queue. 使用外部消息队列来实现延时队列。

Since Storm is fault-tolerant and horizontally distributed, it would make sense to pick a message queue that fits that style, such as: 由于Storm是容错的并且是水平分布的,因此选择适合该样式的消息队列是有意义的,例如:

  • Kafka 卡夫卡
  • Amazon SQS 亚马逊SQS
  • RabbitMQ 的RabbitMQ

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM