Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use Amazon Kinesis and not SNS-SQS?

I have a use case where there will be stream of data coming and I cannot consume it at the same pace and need a buffer. This can be solved using an SNS-SQS queue. I came to know the Kinesis solves the same purpose, so what is the difference? Why should I prefer (or should not prefer) Kinesis?

like image 871
Apoorv Avatar asked Oct 09 '22 07:10

Apoorv


People also ask

When should I use SQS over Kinesis?

Both Amazon SQS and Amazon Kinesis are good at what they do. The difference lies in the architecture a user is adapting. SQS provides fully manageable message queuing services whereas if real-time data is your requirement then Amazon Kinesis is the best option.

What is the difference between Kinesis and SQS?

Kinesis vs SQS Amazon Kinesis is differentiated from Amazon's Simple Queue Service (SQS) in that Kinesis is used to enable real-time processing of streaming big data. SQS, on the other hand, is used as a message queue to store messages transmitted between distributed application components.

Is Kinesis cheaper than SQS?

Every million requests on SQS costs 0.40$, multiply the requests by 3 since read/delete operations count also as transactions. This gives us 4 million requests per day and our billing total to 1.6$. Even with 2–3 shards instead of just one Kinesis is still cheaper (just multiple 0.45$ by the number of shards).

What are the benefits of Amazon Kinesis?

You can use Amazon Kinesis to securely stream video from camera-equipped devices in homes, offices, factories, and public places to AWS. You can then use these video streams for video playback, security monitoring, face detection, machine learning, and other analytics.


1 Answers

Keep in mind this answer was correct for Jun 2015

After studying the issue for a while, having the same question in mind, I found that SQS (with SNS) is preferred for most use cases unless the order of the messages is important to you (SQS doesn't guarantee FIFO on messages).

There are 2 main advantages for Kinesis:

  1. you can read the same message from several applications
  2. you can re-read messages in case you need to.

Both advantages can be achieved by using SNS as a fan out to SQS. That means that the producer of the message sends only one message to SNS, Then the SNS fans-out the message to multiple SQSs, one for each consumer application. In this way you can have as many consumers as you want without thinking about sharding capacity.

Moreover, we added one more SQS that is subscribed to the SNS that will hold messages for 14 days. In normal case no one reads from this SQS but in case of a bug that makes us want to rewind the data we can easily read all the messages from this SQS and re-send them to the SNS. While Kinesis only provides a 7 days retention.

In conclusion, SNS+SQSs is much easier and provides most capabilities. IMO you need a really strong case to choose Kinesis over it.

like image 125
Roee Gavirel Avatar answered Oct 19 '22 11:10

Roee Gavirel