skip to Main Content

AWS SQS

First service of AWS – simple Queue Service

  • SQS is PULL
  • Used to decouple sending / receiving components without requiring each application component to be concurrently available
  • Message oriented API
  • Message can contain up to 256KB of text billed at 64KB chunks
  • Single request can have 1 to 10 messages up to max of 256KB payload
  • One message 256KB is basically 4 requests for billing since (4*64KB)
  • NO ORDER – SQS messages can be delivered multiple times in any order
  • Design – 2 priority queues for priority based message one for higher and other for lower priority
  • EC2 instance always poll messages from the queue (PULL from queue not push)
  • visibility timout always start from when the application instance polled the message
  • Great design – Visibility timeout expires that means there is a failure somewhere since that message was polled but not processed and hence not deleted so other some other process will poll the message again and visibility timeout starts again.
  • Visibility timeout by default is 30 Seconds up to 12 hour maximum use function (ChangeMessageVisibility) to change  visibility timeout .
  • Maximum long polling timeout 20 seconds (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html) —ReceiveMessageWaitTimeSeconds to apply long polling period.
  • Messages in the Queue can be retained for up to 14 days
  • First 1 million request ares free, then $0.50 PER EVERY MILLION REQUESTS
  • YOU CAN CONFIGURE anonymous access via IAM policies
  • If you set Visibility Timeout to 0 this makes messages immediately available
  • After message retrieved it is inaccessible for 30 sec
  • There is a FIFO queue
  • Unsuccessfully processed messages send to Dead Letter Queue
  • Fan out identical messages to multiple SQS queues – use SNS to create a topic – create and subscribe multiple SQS queues to SNS topic – whenever message is sent to SNS topic it is fanned out to the SQS message queue
  • Minimum value for SQS is 1 KB – MAX value is 256KB
  • NO LIMIT to the number of SQS queues
  • DeleteMessage – API request to ensure message does not become visible again
Back To Top