Here’s an architecture of Amazon SQS. You can read top interview questions on Queue messages retention period.
AWS simple queue service (SQS) provides support for message communication among distributed applications. The SQS is asynchronous. That means the response you cannot expect immediately. The prime features of SQS are passing messages, and retention period.
AWS SQS Default Retention Period
- Message Retention Period – This parameter is used to retain the message in queue. After the message retention period configured has expired, the message will be deleted automatically. By default, the message retention period is 4 days and can be extended up to a maximum of 14 days. You can set 1 min to 14 days.
- Default Visibility Timeout – It is 30 seconds. Here is more on Visibility Timeout.
- Role of consumer – when the consumer receives message, It deletes it after processing. Until default visibility timeout, the message is still be available.
- Delivery delay – You can set it from 0 to 15 minutes.
- Redrive policy – This is the policy, where it writes all unprocessed messages to dead letter queue. So that they can be reprocessed. The reason for not processing is any unforeseen technical issues.
AWS Simple Queue Service Architecture
How Messages Pass in and out of SQS Queue
When the user requested some information, first, it hits rout53. The rout53 then assigns the webserver IP address.
The information for the use request, web server alone cannot provide. So it passes to the application server to get information from the database.
The response then back and finally reaches the user.
- It is scalable and durable. There is no chance of message loss.
- The order of message response varies. Not always FIFO (first-in-first out) unless you select FIFO queue.