Amazon Simple Queue Service (SQS) and Amazon SNS are both messaging services within AWS, which provide different benefits for developers. Amazon SNS allows applications to send time-critical messages to multiple subscribers through a “push” mechanism, eliminating the need to periodically check or “poll” for updates.
Amazon SQS is a message queue service used by distributed applications to exchange messages through a polling model, and can be used to decouple sending and receiving components. Amazon SQS provides flexibility for distributed components of applications to send and receive messages without requiring each component to be concurrently available.
Amazon Simple Queue service (SQS) is a fast, reliable, scalable, fully managed message queuing service
You can use SQS to transmit any volume of data, at any level of throughput, without losing messages or requiring other services to be always available.
Each queue start with default settings of 30 seconds for the visibility timeout .
You can change that settings for entire queue.
You can change – specifying a new timeout value using the
ChangeMessageVisibilitiy
- Messages can be retained in queues for up to 14 days.
- the maximum VisibilityTimeout of an SQS message in a queue is 12 hours ( 30 sec visibility timeout default )
- Message can contain upto 256KB of text, billed at 64KB chunks
- Maximum long poling timeout 20 seconds
First 1 million request are free, the $0.50 per every million requests
No order – SQS messages can be delivered multiple times in any order
Amazon SQS uses short polling by default, querying only a subset of the servers to determine whether any messages are available for inclusion in the response.
Long polling setup Receive Message Wait Time – 20 s (value from 1 s to 20 s )
Benefit of Long polling
Long polling helps reduce your cost of using Amazon SQS by reducing the number of empty responses and eliminate false empty responses.
- Long polling reduce the number of empty responses by allowing SQS to wait until a message is available in the queue before sending a response
- Long polling eliminate false empty responses by querying all of the servers
- Long polling returns messages as soon message becomes available
FIFO queues are designed to enhance messaging between applications when the order of operations and events is critical, for example:
- Ensure that user-entered commands are executed in the right order.
- Display the correct product price by sending price modifications in the right order.
- Prevent a student from enrolling in a course before registering for an account.
Note
The name of a FIFO queue must end with the .fifo suffix. The suffix counts towards the 80-character queue name limit. To determine whether a queue is FIFO, you can check whether the queue name ends with the suffix.
Reference
http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html