Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does visibility Timeout mean for AWS SQS

Tags:

What is the meaning of "Visibility Timeout" for Amazon SQS service ? What factors determine an ideal value for this field ?

I have looked at http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/Welcome.html

like image 473
Eastern Monk Avatar asked Feb 25 '15 07:02

Eastern Monk


People also ask

What will happen if you set the Amazon SQS message timer?

Message timers let you specify an initial invisibility period for a message added to a queue. For example, if you send a message with a 45-second timer, the message isn't visible to consumers for its first 45 seconds in the queue.

How does the SQS delivery delay differ from the default visibility timeout?

The difference between the two is that, for delay queues, a message is hidden when it is first added to queue, whereas for visibility timeouts a message is hidden only after it is consumed from the queue.

How long do messages stay in SQS?

You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention quota is reached, your messages are automatically deleted.

Does SQS automatically delete a message from a queue?

Amazon SQS automatically deletes messages left in a queue longer than the retention period configured for the queue. The ReceiptHandle is associated with a specific instance of receiving a message. If you receive a message more than once, the ReceiptHandle is different each time you receive a message.


1 Answers

When using sqs as queuing service, when you read the message off the queue it does not automatically delete the message off the queue. So when you are processing the message, sqs will wait for the time period defined as visibility timeout before other consumers will get the same message again.

The best time value to set for the visibility timeout will be at least the timeout value for the consumer process. If the consumer is able to successfully complete the processing then it would delete the message off the queue else if it times out then the message reappears in the queue for other consumer to pick it again.

like image 137
Rohit Avatar answered Nov 07 '22 03:11

Rohit