【问题标题】:Kinesis- like sharding with SQS?使用 SQS 进行类似 Kinesis 的分片?
【发布时间】:2019-12-25 12:30:32
【问题描述】:

我有兴趣用 SQS 替换 Kinesis(因为它很贵而且我不需要历史日志),但我需要一个分片/分区机制,特别是在使用 Lambda 处理时。

我看到 SQS FIFO 队列最近获得了 Lambda 事件映射 -

https://aws.amazon.com/blogs/compute/new-for-aws-lambda-sqs-fifo-as-an-event-source/

我认为通过使用MessageGroupID 可以使分区非常接近。

消息处理被描述为通过以下规则进行 -

1) Return the oldest message where no other message with the same MessageGroupId is in flight.
2) Return as many messages with the same MessageGroupId as possible.
3) If a message batch is still not full, go back to the first rule. As a result, it’s possible for a single batch to contain messages from multiple MessageGroupIds.

1) 和 2) 听起来很棒 - 每个 Lambda 请求批次只包含一个 MessageGroupID - 但是 3) 似乎把一切都搞砸了:-(

对确保每个 Lambda 请求批次仅包含来自单个 MessageGroupID 的消息的策略有何想法?可能通过MessageDeduplicationID ?

【问题讨论】:

    标签: amazon-web-services amazon-sqs amazon-kinesis


    【解决方案1】:

    怀疑这里的答案是每个“分区”使用一个队列,因为 SQS 定价是基于每条消息而不是每个队列。如果您有很多“分区”,则在堆栈启动过程中以编程方式创建它们(例如,作为 CodeBuild 脚本的一部分),而不是在 Cloudformation 中定义每个队列。

    【讨论】:

    • 我认为这就是方法。需要考虑的事项:a) 跨多个队列的客户端分布,b) 如何定义配置,以便从特定 sqs 队列消费的每个相应节点更容易
    猜你喜欢
    • 1970-01-01
    • 2018-05-27
    • 2020-06-21
    • 2015-10-20
    • 2020-02-25
    • 2015-07-20
    • 2018-01-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多