Simple Queue Service
The queue concept is dead-easy to understand: It’s a communication mechanism between two processing resources that allows them to collaborate on work without needing to operate in a synchronous manner.
Simple Queue Service overview
SQS lets you create a queue in AWS and then place and retrieve messages from that queue. However, you can also set permissions on a queue to allow access to it that’s broader than your account. Being able to enable a broader population to use your queue is useful when you want to allow outside entities, whether a restricted group (say, partners of your company) or the general public, to access it — particularly, being able to submit tasks to your application while not requiring the submitter to wait until the job is complete.
SQS allows multiple message submitters and retrievers to share a queue, which is a fancy way to say that you can allow your queue to have multiple processes placing messages on the queue and removing them. You can, for example, operate a number of AWS instances designed to retrieve uploads of videos for Elastic Transcoder, ensuring that no transcoding request is delayed by a large job ahead of it in the queue.
Despite the lack of a FIFO mechanism. Amazon guarantees that each message is delivered at least once. Until the message is retrieved, it’s retained in the queue, waiting to be read. SQS has a message time-out period that defines how long a message is retained in the queue. The default retention period, set at four days, can be adjusted to meet the requirements of the application.
Another SQS characteristic to be aware of is that queue messages remain in the queue until they’re deleted — even when they’ve been read. AWS does this because, even if a message is read, it may not be fully acted on — the reading application may crash or otherwise fail to complete the task associated with the message
To avoid situations in which the queue message is read but not fully acted upon due to resource failure, AWS implements a visibility time-out: While a message is being read, it’s locked for a period to ensure that no other reader can access it. However, one key task for a reader is to delete the message when the task associated with the message is complete; if the reader fails to delete the message, another process can — when the visibility time-out expires — read the message again and perform the task associated with the message.
Your reading applications must delete SQS messages after they have completed their tasks. The message size in SQS is restricted to 64KB — for many applications, perhaps not a significant restriction; if the complete task is to place someone’s name in a database, 256KB is probably more than ample.
SQS scope
SQS is regionally scoped. Each queue is associated with a particular region;when you create an SQS queue, you define which AWS region will serve asyour queue’s home.
SQS cost
SQS costs $.50 per million SQS requests, where a request is any kind of SQSAPI call. That means both message submission and retrieval, as well as settinga queue attribute and the like would incur a charge. Don’t forget that you also pay for traffic sent out of AWS, starting at $.12 per gigabyte and descending as more traffic is sent. The first gigabyte of outbound traffic is free each month.