Introducing Amazon Simple Queue Service

Amazon SQS is a managed, highly scalable, and durable service that provides developers with a mechanism to store messages that can be later consumed by one or more applications. In this section, we will be exploring a few of the concepts and terminologies offered by SQS along with an understanding of which SQS, queue to use for what scenarios, so let's get started!

To start off with, SQS is provided in two different modes:

  • Standard queue: Standard queues are the default selection when it comes to working with SQS. Here, the queues created offer a nearly-unlimited transaction per second (TPS) rate coupled with an at-least-once delivery model. What this model means is that a message can be delivered at least once, but occasionally there is a good probability that more than one copy of that same message can be delivered as well. This is due to the fact that SQS is designed and built on a highly distributed system that is known to create copies of the same message in order to maintain a high-availability scenario. As a result, you may end up with the same message more than once.

Standard queues also work on a best-effort ordering model, in which case, messages might be delivered in a different order to the one in which they were sent. It is up to your application to sort the messages into the right order in which the messages should be received. So, when is the standard queue an ideal choice for decoupling your applications? Well, if your application has a high throughput requirement, for example, processing of batch messages, decoupling incoming user requests from an intense background processing work, and so on, then standard queues are the right way to go.

Standard queues are available across all AWS regions.

  • FIFO queues: When working with standard queues, there is a problem of maintaining the order of the messages and also ensuring that each message is processed only once. To solve this issue, AWS introduced the FIFO queue that provides developers with a guaranteed order of delivery of messages, as well as the assurance that each message is delivered only once, where no duplicates or copies are ever sent out.

FIFO queues, on the other hand, do not offer an unlimited throughput capacity, unlike their predecessor. At the time of writing this book, FIFO queues support up to 300 messages sent per second, with an additional 3,000 messages per second capacity if a batch of 10 messages per operation is performed.

Such queues are really useful when the order of the messages is of critical importance, for example, ensuring that a user follows the correct order of events while registering or purchasing of a product, and so on.

FIFO queues are currently only available in the US East (N. Virginia), US East (Ohio), US West (Oregon), and EU (Ireland) regions.

With this basic understanding, let's look at some simple steps to get you started with your very own queue in a matter of minutes!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset