Hi everyone! Almost a month back I wrote a blog on Message Queue and there I told you that soon I’ll start writing about Simple Queue Service. For a basic understanding of Message Queues, you can have a look here. Talking about Simple Queue Service, it’s a service provided by AWS, and in short, just known as SQS.
What is Simple Queue Service?
AWS SQS is a fully managed queueing service. It is used to decouple microservices without the overhead of creating queues yourself. It eliminates the overhead of developers, of managing and operating queues themselves. The developers can focus on their work more than focusing on the management of queues.
SQS can be used for asynchronous applications. Rather than sending some messages directly to other applications, the messages can be sent to SQS and from there they can be picked by the processing application at a later time as per its processing capability. This way an application will never be overloaded.
Benefits of SQS
- Security
As it is an AWS service therefore the access to the queue is only to the people who have the aws credentials and also whose users have a permission. This way there won’t be any nwanted access to the queue. - Durability
AWS SQS stores messages on multiple servers to keep them safe ad make it more durable. - Reliability
To make sure multiple producers are able to send and multiple consumers are able to retrieve the messages, the processing message is locked for some time. When the lock expires the message is available again for processing. - Scalability
SQS can easily handle all the requsts and if the load increases it can handle those spikes as well without any provisioning instructions. - Customization
Your queues need not to be a copy of each other. The queues can have a different default delay, more payload than 256 KB by using AWS S3.
How Simple Queue Service work?
- Send Messages to SQS
Once the queue is created, you can start sending messages to it after maximum 1 second.

- Consume Messges from SQS
Any service that wants to work on the messages that we have in SQS can poll them. Now one thing to keep in mind is that the consumer can not specify which message it want to receive, it can only specify the number of messages that it want to receive. Also as the message is polled visibility timeout starts for that message. This is the time for which the lock acquires the message so that any other consumer can not access it or modify it.

- Delete Messages from SQS
Once the message is succesfully processed by the consumer, the consumer can delete the message from SQS. This will prevent the processing of the same message multiple times. Also deletion can only be done after the visibility timeout expires.

Overview of SQS
- You can create unlimited queues.
- The message payload can not be larger than 256KB. If you want to send messages larger than 256KB you can use S3. Save larger messages in S3 and keep the S3 object reference is SQS.
- The SQS messages have a concept of visibility timeout i.e. the time for which the message was not visible to consumers.
- We have deadletter queue as well. The messages that are not received by actual queue, for any reason, are sent to deadletter. With the help of deadletter queue your messages will never be lost and you can always republish them after polling them from deadletter queue.
- Using SQS give you the power to process request later on and not load service much.