SQS/SNS/Kinesis Flashcards
What are the 2 main ways applications can communicate with each other?
- Synchronously (app to app)
- Asynchronously / Event Base (app to queue to app)
Explain SQS
- SQS is used for application integrations
- It lets decoupled apps and services talk to each other.
Is SQS a push or pull service? Explain.
- SQS is a pull service.
- You must pull or ‘poll’ for new messages using the SDK.
What are the 2 main types of SQS messages?
Standard and FIFO
Explain Standard SQS
- nearly unlimited messages/second
- does NOT guarnatee order of delvery
- always delivers at least once
FIFO
- First In, First Out
- Limited to 300 messages/sec (3000/sec if batch)
- Exactly-once send capability (by removing duplicates)
- Messages are processed in order by the consumer
- FIFO Names must end in .fifo
What are the 2 types of polling? Which one is recommended?
- Short polling & Long Polling.
- When a consumer requests messages from the
queue, it can optionally “wait” for messages to
arrive if there are none in the queue. - Short Polling returns immediately even if queue is empty.
- Long polling is recomended because its less API calls which will reduce latency.
What is Visibility Timeout in SQS?
- After a message is polled by a consumer, it becomes invisible to other consumers.
- By default, the message visibility timeout is 30 sec.
- After timeout period ends, the message is available in SQS.
What happens if the SQS visibiity timeout is to high or too low?
- If to high (hours), then comsumer may crash and it will take time to reload
- If too low then we may get duplicates
What happens if a consumer fails to process a message within the visibility timeout period?
Message goes back into the queue.
How many times can a message go back into the queue?
What happens once this limit is reached?
- You set the threshold.
- Once the threshold is met, the message goes into a Dead Letter Queue (DLQ).
When should you NOT use dead letter queues?
- Don’t use a dead-letter queue with standard queues when you want to be able to keep retrying the transmission of a message indefinitely.
- Don’t use a dead-letter queue with a FIFO queue if you don’t want to break the exact order of messages or operations. For example, don’t use a dead-letter queue with instructions in an Edit Decision List (EDL) for a video editing suite, where changing the order of edits changes the context of subsequent edits.
What are Dead Letter Queues useful for?
Dead-letter queues are useful for debugging your application or messaging system because they let you isolate problematic messages to determine why their processing doesn’t succeed.
What is the default, min, and max visibility timeout settings - SQS?
- Default: 30 seconds
- Minimum: 0 seconds
- Maximum: 12 hours
What is a delay queue?
- The ability to delay a message (so consumers don’t see it immediately) for up to 15 minutes.
When are new messages available for consumers to view?
- Immediately, unless a delay is set (aka Delay Queue).
- Can delay up to 15 minutes.
What is the maximum size of an SQS message? What are your options if a larger message size is needed?
- The maximum message size in 256kb.
- You can use the extended client library to send a message size of up to 2GB in size.
- The large message is actually stored in an S3 bucket and a small message gets put into the queue that acts as a pointer to the actual message.
What is the SQS API call to delete all messages in a queue?
PurgeQueue