AWS architecture using Pub/Sub

Hello guys :), this is my first question in this forum.

I am considering Elixir/Phoenix for my next project, it is a social network and, as you can imagine, I am a bit afraid about the user activity feed part.

As you can imagine, when it gets track and reaches a big number of users that are subscribed to hundreds of users, merge all activities for each consumer can be computationally expensive.

I decided for Phoenix because it has OTP underlying, and its Pub/Sub, I thought it could be a good idea to use it in one of the following ways:

  • to make a topic for every active user that publishes anything, but the consumers need a discovery service to know who is right now active.
  • or the reverse, a user publishes and the architecture looks for anybody that can be interested in the moment of the publication.

Has anybody done this before? any ideas? I am using AWS and I am also considering Kinesis or SQS, but I don’t want to be so dependant of a third party tools in case of a possible future migration.

Thanks!

1 Like

A bit offtopic, but maybe this’ll be helpful: http://highscalability.com/blog/2013/7/8/the-architecture-twitter-uses-to-deal-with-150m-active-users.html

I don’t quite see how pubsub fits in, though. Feeds are usually stored somewhere (redis/postgres/ets), and pubsubs are mostly for “real-time” message passing.

Unless you are absolutely sure that this might become a scalability issue, Postgres is a safe choice for storing (or querying) feeds.

2 Likes

Hi, I already knew about this post, I was looking for a way to push the updates to the active users, maybe is a bit offtopic (sorry about that), I was just looking for anyone with experience enough on phoenix pubsub to know if that would be very computationally expensive :D.

I think I will start by querying on postgres, but that was not the ideal to me, as I do not want to stress the DB so much. I want to make profit that a post has been created/edited/liked to send this straight to its consumers.

I will have a look, thanks!

1 Like

So you don’t want to persist some of the notifications that can be delivered to users who are online?

1 Like

I would store the post/message/action into the DB and publish to consumers afterwards, but I think maybe using pubsub it will not scale well, I have to think a better solution :).

Thanks.

1 Like