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
Do subscribers get all published messages for topic they are subscribed to?
Yes, unless they filter them
What is the fan out pattern? What services are included and why is this useful?
The fan out pattern is used if you want to send messages en masse to SQS queues.
You subscribe all the SQS queues to an SNS topic and then they proliferate out from there.
This is much easier than manual integration and is a fully decoupled architecture.
What are the 4 Kinesis services?
Data Streams
Data Firehose
Data Analytics
Video Streams
What is Kinesis Data Streams made for?
Streaming big data into your systems
What are the two capacity modes for Kinesis Data Streams?
Provisioned and on-demand
How are Kinesis Data Streams streams scaled?
More shards are added if more capacity is needed
What is Kinesis Data Firehose?
A service that batch writes data from producers into destinations both inside and outside of AWS. Near real time. Fully managed.
Does Kinesis Data Firehose or Kinesis Data Streams have data storage?
Data Firehose does not
Data Streams does, up to 365 days of replayability
Is Kinesis Data Firehose or Kinesis Data Streams real time?
Data Firehose is not
Data Streams is
When would you use Kinesis for data ordering over SQS and vice versa?
Kinesis would be used when you have larger amounts of data.
SQS FIFO is better if you want to dynamically adjust the number of consumers you will use.
What is Amazon MQ?
A managed service for customers already using RabbitMQ or ActiveMQ - these are open-source message broker services.
MQ has both queue and topic features in one broker.