Using AWS SNS and Lambda - What's the Right Use Case for an Activity Feed

I want to use AWS lambda function to expand and insert activity flow information into firebase endpoint for each user.

Should I be using Kinesis, SQS, or SNS to trigger the lambda function for this use case? Activity stream updates can be triggered from the server, and clients should receive the update in near real time (within 60 seconds or so).

I think I have a pretty good idea of ​​what SQS is and have used Kinesis in the past but am not entirely sure about SNS.

If we created an SNS topic for each user and then each follower subscribes to those topics using the AWS lambda function - will this work?

Does it make sense to programmatically create threads and subscriptions for each user and follow along accordingly?

+3


source to share


1 answer


As usual, the answer to such a question is basically "it depends on your use case".

Kinesi vs. SQS:

If your customers care about relative (e.g. time based, for example) order between events, you will almost certainly have to go with Kinesis. SQS is a Best Effort FIFO Team which means events can go out of order and relative order will be managed for your client.



In terms of latency, I've seen that data hitting Kinesis can be visible to its consumer in less than 300ms.

When can SNS be of interest to you?

(Even with SNS, you will have to use SQS). If you are using SNS, it will be easy to add a new application that can handle your events. For example, if in the future you decide to accept all events in, say, Elasticsearch to provide real-time analytics, all you have to do is add another SQS queue to the existing topic and write to the consumer.

+2


source







All Articles