Concepts

Visibility timeout

SQS setting that hides a polled message from other consumers while it is being processed.

How it works

Amazon SQS visibility timeout temporarily hides a received message from other consumers while a worker processes it. After successful processing, the worker deletes the message. If it does not delete the message before the timeout expires, the message can become visible again for another attempt. Standard queues can deliver duplicates even during the timeout, so consumers should process messages idempotently.

When to use it

Tune it to the time a consumer needs to process one message.

Real-world example

An image worker receives an SQS job and takes about forty seconds to resize a photo. With the default timeout of thirty seconds, the worker calls ChangeMessageVisibility to extend it to two minutes, reducing the chance that the message becomes visible again before processing finishes.

Key facts

  • Default 30 seconds.
  • Too low causes duplicates; too high slows re-processing after a crash.
  • Consumers can call ChangeMessageVisibility to extend it.

Common pitfall

A timeout that is too short can make a message visible while the first worker is still processing; one that is too long delays retry after failure. Even with a suitable timeout, consumers must handle duplicates.

Often confused with

Message retention is how long SQS keeps a message (1 minute to 14 days, default 4 days), not how long it stays hidden.

References

Prepared by Cloud Quest. Check current behavior and limits in the AWS documentation:

SAA-C03 study guide and learning resources

Keywords you will see in SAA-C03 questions

  • processed twice
  • duplicate processing

Understand it for real with 3D models and simulated labs

Connect the concept to a working architecture.

Start learning