This lab will walk you through the steps to create and manage Queues by explaining all the basics needed.
Duration: 45 minutes
AWS Region: US East (N. Virginia) us-east-1
Fun Fact: This was the first ever AWS service offering made publicly available.
Amazon SQS is a reliable, easy to manage, scalable queuing service. SQS is a simple and cost effective cloud application.
AWS SQS can be used to transmit any amount of data, at any level of throughput, without losing messages.It doesn’t interrupt other services when run continuously.
SQS helps to reduce admirative task by scaling high-available messaging clusters. While we pay only for what we use. AWS SQS helps us to save important data which could be lost if an entire application goes down or if any component becomes unavailable.
SQS queue acts as a buffer between the application components that receive the data and the other parts that process the data in the system.
SQS is used for message-oriented architecture. If the processing server cannot process the work fast enough (for whatever reason) the work is queued so that the processing servers can work on it when they have available resources to process the request. This means that work is not lost due to insufficient resources.
The default Amazon SQS ensures that each message is delivered at least once.
There are two types of Queues:
Consider an example of major flash sale on an e-commerice website where people buy and sell a wide range of products. The requirement is all the requests, with respect to the buyer and seller, should be processed in the order they are received by the queue.. To fulfill this requirement, we’ll be using the FIFO queue.
A mobile company is holding a flash sale for their new model with great features at the best price. It is expected that a huge number of buyers will place orders. The company is holding stock for a limited period, so it’s important to track the order that arrives first. Your flash sale receives a huge response and it is now forecasted that only the buyers who place the order first will receive the product.
Let’s understand how messages get in and out of our FIFO queue. Assume the consuming application requests a batch of up to 300 messages, AWS SQS starts filling the batch with the oldest message (REQ A1), and keeps filling the queue until the batch is full. In our case, assume the batch contains only three requests and now the Queue is empty. Once the message batch has left the queue, SQS considers the batch to be In-flight until the batch gets processed completely or the visibility timeout gets expires.
When you have a single consuming application for the queue's output, this is easy to process. It will receive the messages, do its processing and deletes the messages. Now the consuming application is ready to process the next batch of the messages.You can also add an auto scaling group to scale your processing power depending upon the requirements.
Note: SQS won’t release the next batch of messages until the first batch has been deleted.
Labs on types of Queues.
What is Long Polling in SQS & Configuring long-polling for a queue.
What is Visibility Timeout and configuring Visibility Timeout.
What is Delivery Delay and configuring Delivery Delay.