Overview
The exam expects you to know the difference between the three services. See 02-SQS-Standard-Queues, 07-Amazon-SNS and 09-Amazon-Kinesis-Data-Streams.
Comparison
| SQS | SNS | Kinesis Data Streams | |
|---|---|---|---|
| Model | Consumers pull messages from the queue | Pub/Sub: push to many subscribers, each gets a copy | Standard: consumers pull. Enhanced fan-out: Kinesis pushes to consumers |
| After processing | Consumer must delete the message so no one reads it again | ||
| Consumers | As many workers as you want, working together | Up to 12,500,000 subscribers per topic (another lecture says 12,000,000+) | Standard: 2 MB/s per shard. Enhanced fan-out: 2 MB/s per shard per consumer |
| Throughput provisioning | None, managed, scales to hundreds of thousands of messages quickly | None, scales to hundreds of thousands of topics | Shards specified in advance and scaled by you (provisioned), or on-demand adjusted by Kinesis |
| Ordering | Only with FIFO queues | FIFO topics with SQS FIFO queues | At the shard level |
| Persistence | Consumer deletes after processing | Not persistent: if not delivered you may lose it | Replay possible, data expires after retention (1 to 365 days) |
| Special | Individual message delay (for example 30 seconds) | Fan-out with SQS | Real-time big data, analytics and ETL |
SQS vs SNS vs Kinesis Data Streams
Notes
- SQS: 03-SQS-Message-Visibility-Timeout, 04-SQS-Long-Polling, 05-SQS-FIFO-Queues cover its features.
- SNS + SQS: combine with the fan-out pattern, or SNS FIFO topics with SQS FIFO queues (08-SNS-SQS-Fan-Out-Pattern).
- Kinesis capacity modes: provisioned (you specify shards ahead of time) or on-demand (Kinesis adjusts shards).
- Enhanced fan-out gives much higher throughput and lets many more applications read from one stream.
Pull + delete + any number of workers = SQS. One message to many subscribers = SNS. Real-time streaming with replay and shard ordering = Kinesis Data Streams.
Questions & Answers
Q1: Which service lets you replay data?
Answer:
Kinesis Data Streams, because the data is persisted until it expires.
Q2: Which service needs no throughput provisioning and has no persistence?
Answer:
SNS needs no provisioning and is not persistent. SQS also needs no provisioning.
Q3: Which service has ordering by shard?
Answer:
Kinesis. SQS needs FIFO for ordering.
Q4: How do you delay a single message in SQS?
Answer:
Use the individual message delay capability.
Q5: Kinesis standard vs enhanced fan-out?
Answer:
Standard pulls at 2 MB/s per shard. Enhanced fan-out pushes at 2 MB/s per shard per consumer.
Check yourself
Quiz
Flashcards
Click the card (or focus it), then use ← → to move and Space to flip.