This content originally appeared on DEV Community and was authored by Yusuf Turhan Papurcu
Lately I started to learn about queue systems and about their behaviors. As the first point, Let's dive into SQS.
P.S. These are my training notes. It can be left things in void. If you sense this feeling, please warn me in comments.
P.S. You can use localstack for training too
What is SQS?
SQS is basically a secure, durable, and available AWS hosted queue. It can be really useful because it is hosted in 3rd party and has high availability.
SQS has two kind of queues.
- Standart Queue
- FIFO Queue (First-In-First-Out Queue)
Both of them are really close but there is a difference. ´FIFO queues´ provide the added benefits of supporting ordering and exactly-once processing and ensure that the order in which messages are sent and received is strictly preserved.
Here is a detailed article for compare.
What is Short-Long Polling
?
As concept reference, this video is amazing.
Highly recommend to watch first. It is less than 5min anyway.
Here is an explanation from AWS Documents.
What is Visibility Timeout
?
Visibility timeout is the time-period or duration you specify for the queue item which when is fetched and processed by the consumer is made hidden from the queue and other consumers.
The main purpose is to avoid multiple consumers (or the same consumer), consuming the same item repetitively.
Here is a great drawing from AWS Documents.
Also I found a really explanatory answer for this question:
When using SQS as queuing service, when you read the message from the queue it does not automatically delete the message from the queue. So when you are processing the message, SQS will wait for the time period defined as visibility timeout before other consumers will get the same message again.
How to determine Visibility Timeout
?
Here is a quick technique to find best Visibility Timeout for your system:
The best time value to set for the visibility timeout will be at least the timeout value for the consumer process. If the consumer is able to successfully complete the processing, it would delete the message from the queue else if it times out then the message reappears in the queue for other consumer to pick it again.
What is Delay Queues
?
They were basically make your message wait when it added to queue first time. Sound similar to Visibility Timeout
. But work mechanism is kinda different. Better to look document. It wasn't too long or complex.
Here is an explanation from AWS Documents.
Also we can apply this mechanic for message only by using message timers
.
Here is an explanation from AWS Documents.
What is Dead-Letter Queues
?
Here is an explanation from AWS Documents. This is a whole another subject to work on it. So for now I just ping the root document.
Resources
This content originally appeared on DEV Community and was authored by Yusuf Turhan Papurcu
Yusuf Turhan Papurcu | Sciencx (2022-04-20T20:13:27+00:00) Learning AWS – SQS. Retrieved from https://www.scien.cx/2022/04/20/learning-aws-sqs/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.