If instances of an application send ReceiveMessage request at the same time for SQS is it possible for them to receive the same message?

0

In SQS Standard Queues, if, let us say, 3 instances of the same application are running and cosuming messages from that queue (using long polling), if they send the ReceiveMessage request at the exact same time to SQS, is it possible for them to receive the same message? I'm not talking about at-least-once delivery. The application is idempotent, but I want to know if the MessageVisibilityTimeout guarantee that the scenario I described will not occur.

preguntada hace un año280 visualizaciones
2 Respuestas
1

In a distributed system, race conditions can occur that make this possible, or better said, it is not impossible. Idempotency is the solution.

profile pictureAWS
respondido hace un año
0

SQS was designed with the architecture you describe in mind - auto-scaled fleets of worker instances all consuming the same queue are a very common pattern. Receiving the same message is rare (I've never seen it when looking through logs); there's probably no guarantee though and this possibility is covered by the declared at-least-once delivery.

EXPERTO
respondido hace un año
  • With standard queues this can happen. Maybe not a lot, but sure can.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas