AWS SQS.FIFO读取前20,000条消息以确定消息组,读取的顺序是什么?

问题描述 投票:0回答:2

SQS.FIFO 使用什么机制来读取前 20,000 条消息?

这是一些上下文的示例:

在 FIFO 队列上,我们有消息组:

| Group  | Number of messages | 
| A      | 50,000             |
| B      | 100                |
| C      | 5                  |

队列中接收消息的时间:

Group A added at a rate of 100 per second from 11:00:00 onwards  
Group B added at a rate of 10 per second from 11:00:01 onwards
Group C added at 11:05:00

任何消息均不会出现传递延迟。该队列配置了可见性超时,以匹配稍后添加的 lambda 使用者。队列尚未被任何处理。

随后,将上述队列配置为 lambda 函数作为事件源,最大批量大小为 5,长轮询为 2 秒。 lambda 函数需要 1 分钟来处理事件。

前几批包含什么?

| batch | messages |  consumer |
|  1    | AAAAA    | lambda1   |
|  2    | AAAAA    | lambda1   |
|  3    | AAAAA    | lambda1   |
|  4    | BBBBB    | lambda2 ? | 

如果 SQS.FIFO 读取所有消息组中按时间排序的消息,则上面的模型是我期望看到的。 另一种方法是 SQS.FIFO 不断从消息组 A 中读取,直到队列上的消息总数降至 <20,000

有人可以解释一下阅读机制吗?

文档中所述:

AWS SQS.FIFO 队列查看前 20k 条消息以确定 可用的消息组。这意味着如果您有积压的订单 单个消息组中的消息,您无法使用其中的消息 稍后发送到队列的其他消息组,直到 您成功使用了积压中的消息。 enter
image description here

amazon-web-services aws-lambda amazon-sqs aws-sqs-fifo
2个回答
1
投票

SQS.FIFO 读取所有消息组中的前 20,000 条消息,按接收时间排序。

我创建了一个实验,有 3 个消息组,每个消息组分别添加 21k、1K 和 21K,并按照上面列出的顺序发送它们。该队列由 lambda 函数处理,最大批量为 10 条消息。我为 lambda 函数引入了 1 秒的延迟。

可用消息的总队列大小为 42k。对于前 1000 条消息,队列中只有 10 条消息正在传输。然后当队列下降到 <41k I could see 20 messages in flight. This remained so until the queue drained. Here is my mental model of what happened in that queue. The three message groups are represented with blue, green and red bars.

enter image description here


0
投票

我觉得值得一提的是,SQS FIFO 去年将其飞行限制从 20K 增加到 120K。

博客文章

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.