Use case of AWS SQS

Use case of AWS SQS

Hello everyone,

In this article, we will discuss the use case of the AWS SQS service.

Before we get started with our main topic which is SQS first let's understand the basic terminologies that will help us to understand better.

What is Cloud Computing?

To understand Cloud computing let's first break the terms used that is cloud and computing. So first start with the word "Cloud", Cloud is just a metaphor for the internet which means the thing that is not physically present and the other word is "Computing"so computing is a process of using computer technology to complete a task and for computing, we require memory, storage, and CPU. So, altogether we can say that cloud computing provides us virtual computing devices or we can say in-demand availability of computers.

CompassionateSecretGodwit-max-1mb.gif

what is AWS?

Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully-featured services from data centers globally. Millions of customers including the fastest-growing startups, largest enterprises, and leading government agencies are using AWS to lower costs, become more agile, and innovate faster.

image034.gif

Now let's start with our main topic SQS( Simple Queue Service )

SQS ( Simple Queue Service)

Black Technology Blog Banner.png

Here, when a source wants to communicate with a destination and if the destination goes down then there will be no program in the destination to receive information.

The source is directly communicating with the source, they are integrated and this concept is called tightly coupled. Source and Destination are synced with each other, because of a tightly coupled issue if the source communicates to the destination and the destination is down so our process will never complete.

To overcome this challenge, whenever we have two services and we don't want these services directly communicate with each other so for that we can place a middle program between source and destination so, now if the source wants to communicate with destinations so for that source first will send data to a middle program and then the middle program will send that data to destinations.

Reasons to send data first to the middle program:

  • Because the middle program is reliable as it is not one virtual machine, it may have multiple virtual machines running, therefore, it is a cluster of program, this program is highly available and cloud manage this program we don't need to configure it the only thing we need to do is to send the data and middle program will receive the data and when we ask the middle program to send data to somebody and then the middle program will send it.
  • Whatever data we send to the middle program, it will manage data in a queue. So, if the destination program goes down for that point of time that program will hold data in a queue and when the destination program goes back then it can download the data from the queue in the middle program
  • Source can send the data to multiple devices just by producing data once by using the middle program

And this middle program is known as Message Queue

Black Technology Blog Banner (1).png

A message queue is one kind of program, it has internal storage/persistent storage, it can persistently keep our data in a box and this box is called Queue and with the help of this program we decoupled Producer and consumer

Message Queue is just a concept and to implement a message queue so for that AWS has provided a service called SQS( Simple Queue Service )

Usecase of SQS

Amazon using SQS

233733.gif

Amazon is a platform where people buy and sell a wide range of products. Amazon requires that transactions from buyers and sellers get processed in exactly the order received. Here’s how a queue helps you keep all your transactions in one straight flow and if the backend of amazon goes down still front end keeps in running and as soon as the backend comes up it takes the data from the message queue

Voting app

Let's say you've built a mobile voting app for a popular TV show and 5 to 25 million viewers are all voting at the same time (at the end of each performance). How are you going to handle that many votes in such a short space of time (say, 15 seconds)? You could build a significant web server tier and database back-end that could handle millions of messages per second but that would be expensive, you'd have to pre-provision for maximum expected workload, and it would not be resilient (for example to database failure or throttling). If few people voted then you're overpaying for infrastructure; if voting went crazy then votes could be lost.

A better solution would use some queuing mechanism that decoupled the voting apps from your service where the voting queue was highly scalable so it could happily absorb 10 messages/sec or 10 million messages/sec. Then you would have an application tier pulling messages from that queue as fast as possible to tally the votes. [Source: stackoverflow]

Hope you find this article insightful✨

Thank you!!