About Learning SQS
We shall now be giving a brief overview of learning SQS and supports offered.
- AWS service for message queue service and delivery
- queue service is reliable and scalable
- AWS service performs
- Sending messages
- storing messages
- retrieving messages
- used by distributed applications for exchanging messages by polling
- message queue is a cushion or buffer between sender and receiver.
- 256kb message size
- for >256kb use SQS extended client library which uses S3
- it delivers message at least once
- it is not FIFO
- it can be created in any region, messages are retained for 14 days
- messages can be sent and read simultaneously
- long polling decreases frequent polling
- Usually the wait time is 20 secs if queue is empty
- No charge for first 1 million request, USD $0.50 for next 1 million + data transfer charges,
- Message queues can be scaled
- Amazon SQS Architectures
- Priority (2 queues High/Low)
- Fanout (SNS topic/multiple SQS queues for parallel processing)
- Amazon SQS supports
- standard queues
- FIFO queues.
- Standard Queue
- Unlimited Throughput
- At-Least-Once Delivery
- Best-Effort Ordering
- FIFO Queue
- High Throughput
- Exactly-Once Processing
- First-In-First-Out Delivery
Distributed Queues
3 parts in a distributed messaging system
- the components of distributed system
- queue (distributed on Amazon SQS servers),
- messages in the queue.
Below, system send messages to queue and receive messages from queue. The queue (holds messages A through E) redundantly stores the messages across multiple Amazon SQS servers.
Message Lifecycle
Step 1 – A producer or component 1 sends message A to a queue, and the message is distributed across the Amazon SQS servers redundantly.
Step 2 – When a consumer or component 2 is ready to process messages, it consumes messages from the queue, and message A is returned. Message A remains in queue while being processed and not returned to receive requests for duration of visibility timeout.
Step 3 – The consumer or component 2 deletes message A from the queue to prevent the message from being received and processed again when the visibility timeout expires.
Best Practices
- Processing Messages in a Timely Manner
- Handling Request Errors
- Setting Up Long Polling
- Capturing Problematic Messages
- Setting Up Dead-Letter Queue Retention
- Avoiding Inconsistent Message Processing
- Implementing Request-Response Systems
To reduce costs, batch message actions:
- use the Amazon SQS batch API actions
- use long polling together with buffered asynchronous client.
Enrich and upgrade your profile to become an AWS Certified Developer – Associate with expert guidance and Free Practice Test. Become job-ready Now!