Decoupling Applications: SQS, SNS, Kinesis, Active MQ Flashcards
What is the different between synchronous and asynchronous communication?
In synchronous communication, applications talk to each other in real time and are tightly coupled.
In asynchronous communication, applications use a queue or middleware in between themselves to decouple themselves from each other.
Why can decoupling be useful?
If all applications are tightly coupled, a sudden spike in traffic can result in the receiving application being overwhelmed and unable to handle all of the requests.
What is Amazon SQS?
Simple Queuing Service, used to decouple applications through the use of a queue
What is the limit of messages in an SQS queue?
There is no limit
What is the maximum and default retention of messages in an SQS queue?
Max = 14 days
Default = 4 days
What type of delivery do SQS queues have? What does this mean?
“At least once” delivery - this means that the message is delivered at least once, but since messages are only deleted once they have been processed, the same message can be processed by two different consumers at once
What is used to regulate access to the SQS API?
IAM policies
What is SQS message visibility timeout?
A set period of time for which a message is made ‘invisible’ to consumers so that it is not polled directly after being polled by a different consumer
What can a consumer do if it knows it needs more time to process a message it has polled from the SQS queue?
It can increase the message visibility timeout through the use of an API
What are the risks of setting the message visibility timeout to being too short or too long?
Too short: the messages will be consistently processed by more than 1 consumer which is inefficient
Too long: if a consumer crashes the message won’t be processed for a long period of time
What is long polling in SQS?
When a consumer increases how long it waits for a message while connected to the queue if there are no messages in it. Once a message comes in, the consumer goes and processes it
Why is long polling advantageous?
It reduces the number of API calls made to SQS while increasing the efficiency and reducing latency of the application
What does FIFO stand for?
First-in, first-out
What is the 1 positive and 1 negative of FIFO queues?
Positive: exactly-once delivery - no need to worry about duplicate processing
Negative: decreased throughput
What model does SNS work off? What does this mean?
Publish/Subscription model - multiple subscribers receive messages as and when they are published by a publishing source