Section 12: AWS Integration & Messaging: SQS, SNS & Kinesis Flashcards
What are the two patterns of application communication?
Synchronous communications (application to application) Asynchronous / Event based communications (application to queue to application)
Why can synchronous communications between applications be problematic?
If there are sudden spikes of traffic, the destination probably wonโt be able to handle everyhting at once (Ex: An app usually encode 10 videos/hour but now suddenly receives 1000 videos in a short amount time)
What are the three integration and messaging fully managed services by AWS?
SQS
SNS
Kinesis
What is the model of SQS?
Queue model
What is the model of SNS?
Pup/Sub model
What is the model of Kinesis
Real-time streaming model
What are the two types of queue available in SQS?
Standard Queue
FIFO Queue
What name defines the entities sending messages to an SQS queue?
Producers
What name defines the entities consuming messages of an SQS queue?
Consumers
How are messages consumed from an SQS queue?
They are polled by the consumers
How old is the AWS SQS standard queue?
Over 10 years old
What do you have to do in order to scale your standard AWS queue?
Nothing, it scales automatically to 10,000s messages per second
What is the default retention rate of messages in a standard SQS queue?
4 days
What is the maximum retention configurable for messages in an SQS queue?
14 days
What is the limit of how many messages can be in a standard SQS queue?
No limit
What is the latency for SQS queues
< 10ms
Can the number of consumers of an SQS queue scale? If so, on which axis?
Yes, it can scale horizontally
Can a standard SQS queue have duplicate messages?
It can occasionally
Are messages in order in a standard SQS queue?
Not necessarily (best effort ordering is built into the service)
How can you get messages 100% in order in SQS?
Use a FIFO Queue rather than a standard SQS queue
What is the maximum size of messages in an SQS queue?
256KB
How can you add a delay between the moment a message is sent and the moment consumers see the message in an SQS queue?
By adding a delivery delay at the queue level
How can you override the default delivery delay for a certain message sent in an SQS standard queue?
By overriding the default DelaySeconds parameter when sending a message
How can you override the default delivery delay for a certain message sent in an SQS FIFO queue?
You canโt, DelaySeconds is only available in standard queues (It make sense, other FIFO would not be respected)
What consists of a message (sent to an SQS queue) ?
Body (String, up to 256KB)
Attributes (Metadata)
What does the producer gets back when sending a message to an SQS queue?
Message ID
MD5 hash of the body
How many messages at a time can a consumer receive when polling an SQS queue?
Up to 10
What is called the time period within which a message is hidden from the consumers because it has been consumed?
The visibility timeout
What happens during the visibility timeout?
The message received by the consumer is still in the SQS queue but is considered โin flightโ therefore it canโt be received by other consumers
What is the responsibility of the consumer when he successfully finishes to process a message?
He needs to delete the message from the queue using the message ID and the receipt handle
What is the default time period of the visibility timeout in an SQS queue?
30 seconds
What is the maximum time period of the visibility timeout in an SQS queue?
12 hours
What can happen if the time period of the visibility timout of an SQS queue is too high?
If the consumer fails to process the message, there will be a long delay before trying to process the message again
What can happen if the time period of the visibility timout of an SQS queue is too low?
If the consumer needs time to process the message, another consumer will receive the message and the message will be processed more than once
What can you do if you set the visibility timeout of your SQS queue too low and a consumer needs more time to process a message?
Use the ChangeMessageVisibility API to increase the length of the visibility timeout of the message being processed at the moment
What is the API that a consumer of an SQS queue needs to call when successfully finishing to process a message?
The DeleteMessage API
(SQS queue) Where should messages that fail to get processed multiple times in a row be transferred to?
To a DLQ
What does DLQ stand for?
Dead Letter Queue
What is the redrive policy?
The redrive policy specifies the source queue, the dead-letter queue, and the conditions under which Amazon SQS moves messages from the former to the latter if the consumer of the source queue fails to process a message a specified number of times.
What strategy for our consumers allows us to save costs when using SQS queues
Long polling
What is the long polling?
A consumer requests message from queue and โwaitโ for message if there are none at the moment
What is the maximum wait time when doing long polling to as SQS queue?
20 seconds
What is the preferred wait time when doing long polling to as SQS queue?
20 seconds
At what level can long polling be enable?
At the queue level or at the API level
What is the name of the parameter which allows us to set the time for long polling?
WaitTimeSeconds
What happens to messages which donโt get deleted within the visibility timeout period?
They become visible again in the SQS queue, up to the defined treshold (redrive policy), when they will therefore be transferred to the DLR
What is the particular naming rule for FIFO queues in SQS
They must end with .fifo
What is the maximum number of messages per second (with / without batching) for FIFO queues?
3000 messages/sec with batching
300 messages/sec without batching