AWS SQS Overview
- SQS provides two types of Queues – Standard & FIFO
- Amazon SQS is a highly available distributed queue system
- It helps to build distributed application with decoupled components
AWS SQS Core Features
- Access Control – You can control who sends and receives messages.
- Delay Queues – Control how much time delay before its available into queue.
- Redundant Infrastructure – Guarantees delivery of a message.
- Dead letter queue – store not processed messages.
- PCI compliant – Compliant with payment card and data security standard.
- Multiple writers and readers – Multiple components send and receive messages at same time.
What is Visibility Timeout?
When receiver received a message from the queue, the message remains in the queue and amazon SQS does not delete automatically. To avoid other receiver receives same message, we can set visibility time out period for each message(basically avoid duplicate) until processed it and delete from the SQS.
If first receiver can’t delete message before visibility timeout period, same message will be available to another receiver.
What is delay queue ?
Delay queue property allows you to postpone the message put in the queue( Basically message will be invisible number of time for receivers)
What is the different of Short Polling and Long Polling?
- Short Polling return result immediately and check on subset of servers.
- Long Polling will not return response until there is a message in the queue. Also check every server to avoid empty response
- Going polling should be used when possible because it can reduce the costs.
Distributed Queues Architecture
AWS SQS Pricing
Price per 1 Million Requests after Free Tier (Monthly)
Standard – $0.40 ($0.00000040 per request)
FIFO – $0.50 ($0.00000050 per request)
AWS SQS Restriction and Limitation
- Queue name can have up to 80 characters.
- Maximum of approximately 120,000 inflight messages in a queue.
- Maximum Message size is 256KB of text in any format. If exceed, you can use DynamoDB or S3 to store and reference id will be in SQS.
- Delay Queue – 0 Second to 15 Minutes ( default is 0 Seconds).
- Message Retention Period – 1 Minutes to 14 Days ( default is 4 Days).
- Visibility Timeout – 0 Minutes to 12 Hours ( default is 30 Seconds).
- Message Retention Period – Amount of time a message will live in queue if it is not deleted.
- Receive message wait time – if value is grater than 0, long polling will be enabled.