SQS stands for Simple Queue Service. It is the Managed Message Queue service provided by AWS cloud.
What is Message Queue?
It is the program that can manage the Information/data/message in a queu. Also it has the capability to store this queue information until the destination program is up(In case if it is down).
What’s the need of this Message Queue?
Lets Assume a situation, when the source program and the destination services are up and have a successful connection, then we say that the programs are tightly coupled with each other (i.e., sync with each other).
we don’t want that they would be tightly coupled to each other, because maybe the destination is not very much secured, hence we want a mediator.
- A (Producer Program ) : The program that is producing the information.
- B(Consumer Program) : The program that is gonna access the data from the Message Queue.
- MQ (Middle ware) : The mediator program for the smooth and efficient communication of Source and Destination, is known as Middle ware.
With Middle ware setup, A and B would be decoupled. The throughput of Message queue is very high.
** SQS is the service by AWS that provide and manage Message Queue.
- Amazon SQS is a highly available distributed queue system
- A queue is a temporary repository for messages awaiting for processing and acts as a buffer between the component producer and the consumer
- SQS is a message queue service used by distributed applications to exchange messages through a polling model, and can be used to decouple sending and receiving components.
- These queue are fully managed and requires no administrative overhead and little configuration
- They offers a reliable, highly-scalable, hosted queue for storing messages in transit between applications
- provides fault tolerant, loosely coupled, flexibility of distributed components of applications to send & receive without requiring each component to be concurrently available
- helps build distributed application with decoupled components
- supports the HTTP over SSL (HTTPS) and Transport Layer Security (TLS) protocols for security
- SQS provides two types of Queues — Standard & FIFO
How SQS Queues Works
- SQS allows queues to be created, deleted and messages can be sent and received from it
- SQS queue retains messages for four days, by default.
- Queues can be configured to retain messages for 1 minute to 14 days after the message has been sent.
- SQS can delete a queue without notification if any action hasn’t been performed on it for 30 consecutive days.
- SQS allows the deletion of the queue with messages in it
Features in SQS for Message Availability
- Retention Period : This is the time period in which SQS will have the Message/information within their storage even after the message is retrieved(by default)
- Visibility Timeout : This is the timeout feature that create a setup within which if a (same/different) consumer program access the information then the next retrieval can be done only after 30 seconds(by default), we can also change this time.
- Dead Letter Queue(DLQ) : This is one of the feature of SQS, that throws the message queue data into some other queue(different from the main) after a certain number of information retrieval i.e., after 10 times(by default, can be changed as per the requirement).
Use of SQS by multiple companies
The are many companies in the world who are using SQS for different different purposes. After a research, there is a concluding image that is showing that how multiple companies are using SQS in different-different places of this world.
- * Dark the color: More use of SQS
- *Light the color: Less use of SQS
This is how SQS service is used by multiple companies and getting benefited by the same.
SQS Use Cases
SQS can be used for multiple things, like
- Work Queues
- Decouple components of a distributed application that may not all process the same amount of work simultaneously.
2. Buffer and Batch Operations
- Add scalability and reliability to the architecture and smooth out temporary volume spikes without losing messages or increasing latency
3. Request Offloading
- Move slow operations off of interactive request paths by enqueueing the request.
- Combine SQS with SNS to send identical copies of a message to multiple queues in parallel for simultaneous processing.
5. Auto Scaling
- SQS queues can be used to determine the load on an application, and combined with Auto Scaling, the EC2 instances can be scaled in or out, depending on the volume of traffic
Hope this detailed information about SQS may help you to find multiple SQS uses at different different places and different requirements.
Keep Learning, Keep Sharing!!✨