14 - Decoupling Applications SQS SNS Kinesis MQ

SQS vs SNS vs Kinesis

awssqssnskinesiscomparisonsaa-c03

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

SQS Consumers pull Delete after processing No provisioning Ordering: FIFO queues only Individual message delay SNS Pub/sub: push to subscribers Each subscriber gets a copy No provisioning Not persistent Fan-out with SQS Kinesis Data Streams Standard: consumers pull Enhanced fan-out: push Replay within retention Ordering per shard Real-time big data, ETL
Pull and delete, push to subscribers, or a persisted replayable stream.

Notes

Exam

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.