Time period between duplicate messages

2019-08-05 12:36发布

问题:

According to the documentation for SQS (emphasis mine):

Amazon SQS stores copies of your messages on multiple servers for redundancy and high availability. On rare occasions, one of the servers storing a copy of a message might be unavailable when you receive or delete the message. If that occurs, the copy of the message will not be deleted on that unavailable server, and you might get that message copy again when you receive messages. Because of this, you must design your application to be idempotent (i.e., it must not be adversely affected if it processes the same message more than once).

What time period can reasonably occur between the original and duplicate messages being received? (seconds? hours? months?)

回答1:

I have no specific proof or link to show you, but in my experience working with SQS you are talking about a range of time that is under a few minutes in most cases. The possibility of a duplicate message happening will be because of activity that took place on the message during the very small lag of time as the message is replicated via very high speed connections to redundant queues within the AWS infrastructure, so in other words, very quickly. It is also likely going to be affected by the visibility timeouts you have specified.