Amazon SQS ( Simple Queue Solution) is a fully managed message queuing service for effectively communicating between dispersed software components and microservices - at any size. This blog on "AWS SQS" will explain what Amazon Simple Queue Service is, including its features and benefits.
Queues have always played an integral role in software architecture. They allow asynchronous communication among the systems having different throughputs. With the recent trend towards microservices, queues have become more important than ever before. To produce robust software architectures, Amazon also offers its own version of queues in the form of AWS SQS (Simple Queue Service).
|Want to become a Master in Cloud Computing? Visit here to Learn AWS Online Certification Course|
|In this AWS SQS tutorial, we are going to discuss the following topics:|
[ Related Article: AWS Services Overview ]
Amazon SQS is a distributed queue system that allows applications to queue messages that are generated by one component and consumed by another component. SQS acts as a temporary repository for messages and is used in situations where the messages are produced at a higher rate but get processed at a lower rate.
There are three parts to the SQS messaging system - components of a distributed system, a queue, and messages in the queue.
From the given image, you can see that a system consists of many producers (components that generate messages and send it to the queue) and consumers (components that retrieve messages from the queue and process them). Stay tuned with the AWS SQS tutorial to learn more concepts of SQS.
SQS queues can be created and scaled automatically based on the demand. With SQS, a user need not install any messaging software to carry out operations and maintain the infrastructure.
Amazon SQS decouples the application components which makes them run or fail independently and increases the overall fault tolerance of the system. Copies of all the messages are stored across multiple zones to avail them whenever needed.
With the help of Amazon server-side encryption (SSE), we can encrypt our data and share it between the applications. Integration of Amazon SSE with AWS KMS (Key management service) allows a user to centrally manage the keys responsible for protecting SQS messages and other AWS resources.
Amazon SQS scales dynamically based on demand, therefore, you do not have to pre-plan the capacity and worry about pre-provisioning. There can be an unlimited number of messages per queue and the cost is based on usage. So, we can say that it is a cost-effective and elastic service.
Now the next section in this Amazon SQS tutorial article will help you know about the amazing features of AWS SQS.
SQS ensures that the messages sent are not lost and secure. Hence, it stores them on multiple standard queues.
SSE (server-side encryption) allows the transmission of highly confidential and sensitive data by offering protection to the messages present in the queues with the help of Amazon's key management service
In SQS, every buffered request is processed independently ie. each request is scaled transparently to handle the increase in load without any explicit instructions.
SQS locks the user messages when it is being processed so that various producers can send messages to various receivers and receivers could receive messages from multiple recipients at the same time.
Amazon SQS offers two types of queues - standard and FIFO queues for different application requirements.
A user can create unlimited SQS queues processing an unlimited number of messages in any region.
Messages payload can be of a maximum 256Kb size in any format. Each 64KB of a payload is considered as 1 request, hence, a single API call with 256KB payload is considered as 4 requests. If a user wants to send a message having a size larger than 256KB, he can use Amazon SQS extended client library for Java.
For the first 1 million, monthly requests are free. But after that, the user will be charged which may vary depending upon the region. For eg. for the region, US (east), Amazon SQS pricing is as follows-
[ Related Article: Interview Questions on AWS]
Amazon SNS (Simple Notification Service) is a fast and flexible push notification service that allows a user to send messages to a large number of mobile users, email recipients, and also other distributed services. Amazon SQS is a distributed queuing system where messages are not pushed but receivers have to poll SQS to receive messages.
|Entity Type||Topic (Pub/Subsystem)||Queue (Similar to JMS)|
|Message Consumption||Push Mechanism||Pull Mechanism|
|Use Case||Fanout (the same message is processed in different ways)||Decoupling two applications and allow parallel asynchronous processing|
|Persistence||No persistence. If a customer is unavailable, the message is lost||The message is persisted for some time if the consumer is unavailable|
|Consumer Type||Consumers are supposed to be identical and process the message in the same way||Consumers process the message in different ways|
When it comes to creating a message-based cloud application having distributed architecture, AWS offers two options - the Kinesis stream and the SQS queue. Which one to choose - SQS or Kinesis? Both the technologies seem similar but they have vastly different use cases. Kinesis is designed to manage and process real-time continuous data streams whereas SQS makes it easy to decouple and scale serverless applications, microservices, and distributed systems.
[ Related Article: Introduction to Microservices ]
To get the absolute maximum throughput for data processing, Kinesis is the best choice. The delay time between writing a data record and reading it from the Stream is less than a second, regardless of how much data a user needs to write.
If you have to process terabytes of data on a daily basis in a single Stream, Kinesis is the best option to go with. A user can push data from various data producers, which is stored for later processing or read out in real-time.
SQS is very easy to use. In contrast to Kinesis, the user does not have to read special libraries or write to an SQS queue. Also, no need to coordinate among consumers.
SQS easily scales to manage and process a large volume of messages, without user intervention and no pre-provisioning of AWS resources. Amazon SQS buffer requests to manage the spikes in load with ease.
Hopefully, this simple walkthrough has helped you find out what is Amazon SQS and how it fulfills the queuing needs in software architecture. Let us know how did you like this AWS SQS tutorial article and comment down if you have any queries regarding Amazon SQS.
|Explore AWS Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download Now!
|AWS Training||Jun 28 to Jul 13|
|AWS Training||Jul 02 to Jul 17|
|AWS Training||Jul 05 to Jul 20|
|AWS Training||Jul 09 to Jul 24|
Pooja Mishra is an enthusiastic content writer working at Mindmajix.com. She writes articles on the trending IT-related topics, including Big Data, Business Intelligence, Cloud computing, AI & Machine learning, and so on. Her way of writing is easy to understand and informative at the same time. You can reach her on LinkedIn & Twitter.