当消费缓慢时扩展我的 Kinesis 消费者

发布于 2025-01-11 15:21:42 字数 277 浏览 0 评论 0原文

假设我有一个包含 2 个分片的 AWS Kinesis 流。 因此,我有两个消费者从每个分片进行消费。

队列中有大量条目,我的消费者正在缓慢地消耗它。 为了解决这个问题,我可以使用 Kafka 消费者组之类的方法,创建两个消费者应用程序并消费记录。

但我想知道是否可以重新分片我的队列(这将跨分片分配记录)并为该分片添加消费者。 即重新分片后,我的流将有 4 个分片,因此有 4 个消费者。 这样也能增加消耗,解决我的问题。

当队列出现摄取问题时,通常建议使用第二种方法,第二种方法的优缺点是什么?

Assume I have a AWS Kinesis stream with 2 shards.
Therefore I have two consumers consuming from each shard.

There are large number of entries in the queues and my consumer is consuming it slowly.
To solve this I can go with Kafka consumer group like approach ,create two consumer applications and consume records.

But I want to know whether I can Reshard my queue (which will distribute the records across shards) and add consumers for that shards.
i.e After resharding my stream will have 4 shards and hence 4 consumers.
This will also increase the consumption and solve my problem.

Whats the pros and cons of the second approach as the second approach is generally suggested when the queue has ingestion issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人哭 2025-01-18 15:21:42

添加分片以增加消耗能力正是 kinesis 的目的。它将增加“消费者应用程序”的并行性,并且应该非常无缝。

请注意,AWS 最近引入了无服务器运动模型,您不必再关心分片计数。这几乎相当于让 aws 自己关心分片的数量,因此您不必再担心这个问题。

Adding shards to increase consuming capacity is exactly what kinesis is about. It will increase the parallelism of your "consumer application" and should be pretty seamless.

Note that aws recently introduced a serverless kinesis model where you don't have to care about the shard count anymore. It's pretty much equivalent to letting aws care about the number of shards by itself so you don't have to worry about that anymore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文