Learning AWS Day by Day — Day 52 — Amazon Simple Queue Service (SQS)

Saloni Singh - May 1 - - Dev Community

Exploring AWS !!

Day 52

Amazon Simple Queue Service (SQS)

Helps in integration and decoupling of software systems and components. It offers dead-letter queues and cost allocation tags.

Benefits:
Security: you can control sending and receiving of messages from SQS. Can use default SQS server-side-encryption (SSE) or custom SSE keys managed in KMS for transmitting sensitive data.
Durability: SQS stores your data on multiple servers. Standard queues support at-least-once delivery message and FIFO queues support exactly once support message processing and high throughput mode.
Availability: SQS provides high availability for production and consumption of messages.
Scalability: buffered requests can be processed, scaling for handling any load increases or spikes.
Reliability: SQS locks the messages while processing, so that multiple producers can send messages and multiple consumers can receive it.
Customization: Your SQS queue need not be exactly same, you can set some default delay on the queue. Storage of message contents can be increased using S3 or DynamoDB, with SQS pointing to S3 or splitting larger messages into smaller.

SQS Architecture:
Three main parts of a distributed system: components, queue, messages in queue.
Lets say in this scenario, your system has several producers (components that send messages to queue) and several consumers, which receive messages from the queue, the messages (blue and green in color) are stored across multiple SQS servers.

Image description
Message Lifecycle:

  1. A producer sends message ‘blue’ to a queue, which is stored across multiple servers.
  2. When consumer needs to process a message, it consumes them from queue, and returns the message ‘blue’. Till the time ‘blue’ message is being processed, it remains in the queue and isn’t returned to the requests till the visibility timeout.
  3. The consumer then deletes the message from the queue to avoid processing and receiving again when the visibility timeout expires.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player