Amazon SQS 中的轮询期间消息会发生什么?

huangapple go评论78阅读模式
英文:

What happen to a message during poll in Amazon SQS?

问题

当我阅读这个Amazon SQS文档时,我发现:

队列(包含消息A到E)会在多个Amazon SQS服务器上冗余存储消息。

所以,我的问题是,当我从SQS中轮询消息A时,这个消息A是来自单个服务器吗?那么存储在不同服务器上的消息会发生什么?它们是如何在可见超时之前保持不可见,或者在消费者在处理后删除消息时被删除的?

英文:

When I was going through this Amazon SQS Document
I found that

The queue (which holds messages A through E) redundantly stores the messages across multiple Amazon SQS servers.

Amazon SQS 中的轮询期间消息会发生什么?

So, my question is when I poll Message A from SQS, does this Message A come from single server? Then what happened to the message which is store in the different server? How they remain invisible up to visible timeout or get deleted when consumers delete the message after processing?

答案1

得分: 3

以下是翻译好的部分:

与 AWS 服务交互时,您只会触及到 API 交互的单个服务器(尽管这不是队列存在的同一服务器,它只是前端 API)。

要理解底层发生的情况,只能进行推测,但基于其他服务的工作方式,该服务将尝试从队列中获取项目,同时更新项目的可见性。这将与包含您排队项目的所有节点并行发送。然后将这些返回给您。

查看文档,以下内容被说明:

标准队列支持至少一次消息传递。但是,偶尔(由于允许几乎无限吞吐量的高度分布式体系结构的原因),可能会按顺序传递多个消息的副本。

从这一行可以看出,“至少一次” 表示在所描述的时间段内消息可能会被传递多次的机会始终存在。

英文:

Whenever you interact with an AWS service you will only be touching a single server for the API interaction (although this would not be the same server the queue exists, it is simply the front-facing API).

For understanding what happens under the hood you can only speculate, however based on how other services work the service will attempt to get the items from queue whilst updating the visibility of the items. This would be sent in parallel to all nodes containing your queued items. These are then returned to you.

Taking a look at the documentation the following is stated

> Standard queues support at-least-once message delivery. However, occasionally (because of the highly distributed architecture that allows nearly unlimited throughput), more than one copy of a message might be delivered out of order.

From this line it states at-least once which indicates that there is always a chance that a message can be delivered more than once during the period described.

huangapple
  • 本文由 发表于 2020年8月2日 13:45:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/63212784.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定