Amazon Simple Queue Service also known as the AWS SQS in AWS cloud. It is fully managed message queues for the serverless applications, micro-services and distributed systems. SQS eliminates the difficulties and burden of managing the message or notification produced by any middleware system.
It is a message queue service used by distributed system applications to exchange messages through a polling model, and can be used to decouple sending and receiving components.
It supports HTTP over SSL (HTTPS) and transport layer security (TLS) protocols for the security.
Using SQS you can store, send and receive messages between software services at any size, without losing messages or requiring other services to be available.
SQS provides two types of message queues →
- SQS Standard Queue → It provides maximum throughput, at-least-once delivery, Message Sampling, and batching.
- SQS FIFO Queue → It is designed to make sure that messages are forwarded exactly one time, in order that they are sent to the queue.
Benefits of Using SQS →
- Eliminates administrative overhead → SQS is fully managed service provided by aws in which no role of administrator came in play again and again. This is possible because once you create the queue, behind the scene aws managed all the backend services need to keep uptime and high availability of this service.
- Reliable delivery messages → SQS can deliver the message of any volume with maximum throughput, without losing messages or requiring other services to be available.
- Keep sensitive data secure → YOu can use SQS provided by AWS to exchange sensitive data between applications using server-side encryption (SSE) to encrypt each message body. It also has the facility to integrate with aws key management (KMS) allows you to centrally manage the keys that protect SQS messages.
- Scale elastically and cost-effectively → It provides no limit on the number of messages per queue so if the messages are more then it scale-out automatically and scale-in. This whole process is managed by the AWS engineers.
Some More features of AWS SQS →
- Visibility timeout →
- SQS doesn’t delete the messages from the queue by itself once the message is received by the consumer, because the system is distributed and there is no guarantee it will actually receive the message.
- Consumers should delete the message by ownself from the queue when they receive the message and process it.
- If the consumer downloads the message from the queue and processes the message and forgets to delete it then the message is available in the queue and if it again polls by any other consumer from the same distributed system then it will create multiple spamming and this needs to be prevented.
- SQS handles this type of situation with Visibility Timeout. SQS blocks the visibility of messages for some time when one consumer downloads the message. This visibility time is decided by the user on the basis of time taken to process and pass the delete command to the queue for the message.
- Dead-letter-queue →
- This is also a great feature provided by SQS to prevent the processing of messages many times if the consumer forgets to pass the delete command once it receives and processes the message.
- If the consumer polls and again and again same message then we can set delete or transfer the message somewhere so that main queue became empty and next time if consumer polls they don’t same message.
- This concept is developed using Dead-letter-queue. In this you can make one new queue and in the main queue attach this queue in option “dead-letter-queue” by setting a maximum threshold which means maximum how much time consumers can download the same message.
- Integration with Lambda –>
- SQS provides the great facility of integration with lambda service of the aws.
Some Companies that are using AWS SQS service to solve their challenges →
- Change Healthcare
Challenge Solved of BMW using AWS →
The BMW Group is using AWS for its new BMW 7 series cars to give drivers dynamically updated map information. BMW built its new car-as-a-sensor (CARASSO) service in only six months using Amazon Simple Storage Service ( Amazon S3 ) , Amazon Simple Queue Service (Amazon SQS), Amazon DynamoDB, Amazon Relational Database Service (Amazon RDS ) and AWS Elastic Beanstalk.
BMW uses SQS for decoupling Receiver and Worker. The receiver keeps on adding messages to the SQS and Worker continuously polls the data and processes it and stores this data into the RDS database and MApData.
Challenge Solved of redBus using AWS →
redBus is an Indian travel agency that is specialized in providing the traveling bus ticket service all across the country. The company previously uses the traditional data center by purchasing and renting its system and infrastructure.
The biggest problem was that its data center can’t handle the request which gave the bad impact to the company.
After doing lots of testing on small applications for several months the company realizes that AWS is a reliable and more better solution to switch on its infrastructure and services.
The company uses many of the AWS services like Amazon Elastic Cloud Computing, Elastic Load Balancer, Amazon Relational Database Service, Amazon Simple Storage Service, Amazon Elastic Block Store and Amazon CloudWatch.
redBus also use the Amazon Simple Notification Service and Amazon Simple Queue Service for monitoring, alerts, and intercommunication.
Amazon SQS is an especially good solution for enabling messaging between external applications and our applications.says Padmaraju.
I hope you found this article useful and learn a lot of new things about AWS SQS.