Jones Zachariah Noel N
zachjonesnoel

Follow

zachjonesnoel

Follow
Standard v/s FIFO : SNS & SQS

Standard v/s FIFO : SNS & SQS

Jones Zachariah Noel N's photo
Jones Zachariah Noel N
ยทDec 19, 2021ยท

3 min read

Play this article

Amazon SNS and Amazon SQS both offer Standard and FIFO variants of topics and queues respectively which helps you build better micro-service focused, de-coupled applications. Some of the basic understanding of SNS and SQS with the technology and concepts behind is explained in - {%post aws-builders/getting-started-with-sns-and-sqs-3m4i %} The previous blog post explains about when and how to choose SNS or SQS for your application need. {%post aws-builders/when-to-sns-or-sqs-2aji %} And this blog post, will give you a better understanding of Standard and FIFO variants of topics and queues.

What is Standard topic/queue?

Standard topics/queues are used often when the system can handle messages which can arrive more than once and without a proper order.

Standard topic/queue

What is FIFO topic/queue?

FIFO topics/queues follows the concept of First-in,First-out which guarantees the order of messages is very necessary. This strictly maintains the order of the message and also doesn't deliver the same message multiple times.

FIFO topic/queue

Standard v/s FIFO : SNS

Amazon SNS offers topics of two variants - Standard topics and FIFO topics. Standard v/s FIFO : SNS

FeatureStandard topicsFIFO topics
ThroughputNearly unlimited no. of messages per second.300 messages per second or 10 MB per second (whichever is first).
Message orderOrder of messages will not be same as published order.Order is maintained by following first-in-first-out (FIFO).
Message deliveryAt-least once, can duplicate again.Only once.
Subscription typesAmazon SQS, Amazon Kinesis Data Firehose, AWS Lambda Fns, HTTPS, SMS, Email, mobile push.Only SQS FIFO queues.
Limits100,000 standard topics with 12.5M subscriptions per topic per account.1,000 FIFO topics with 100 subscriptions per topic per account.
Encryption (via AWS KMS)Both at rest and in transit.Both at rest and in transit.
Pricing (more info in SNS pricing)First 1M requests free, $0.5 per 1M requests.Publish and publish batch API requests are $0.30 per 1M and $0.017 per GB of payload data and subscription messages are $0.01 per 1M and $0.001 per GB of payload data.
Use-caseWhenever there is multi-subscriber scenario, Whenever the application can handle duplicate and unordered messages.Whenever the need for ordering is a must.

Standard v/s FIFO : SQS

Amazon SQS offers queues of two variants - Standard queues and FIFO queues. Standard v/s FIFO : SQS

FeatureStandard queuesFIFO queues
ThroughputNearly unlimited number of transactions per second per API action300 message per second with a batch of 10 messages per operation.
Message orderOccasionally order of messages will not be same.Order is maintained by following first-in-first-out (FIFO).
Message deliveryAt-least once but can get a copy of the same messageOnly once.
Message persistenceMax upto 14 days.Max upto 14 days.
Encryption (via AWS KMS)Both at rest and in transit.Both at rest and in transit.
Resolvers / TriggersLambda Fns and SNS topics.Lambda Fns and SNS topics.
Pricing (more info in SNS pricing)First 1M requests free, $0.4 for 1M-100B requests, $0.24 for over 200B requests.First 1M requests free, $0.5 for 1M-100B requests, $0.35 for over 200B requests.
Use-caseWhenever the application can handle unordered and multiple delivery of messages such as decoupling transaction ordering process, batch processes.Whenever the message have to be ordered such as image/video decoding/encoding, using as subscriber to a FIFO topic.

Conclusion

Whenever choosing SNS or SQS choosing between Standard variant and FIFO variant is also necessary as the features of message ordering, exactly once delivery would help building efficient systems. Variants

ย 
Share this