views:

32

answers:

1

Hi,

I have a web app where users can follow one another. When one user publishes some action, I'd like that action to appear in the feeds of followers. A simple approach might be keeping a feed.xml file for each user, which is updated like:

UserA is followed by UserB, UserC.

UserA publishes some content.

Update UserB, UserC xml feeds, like:

// feed-UserB.xml
UserA flew a kite.
UserX blah blah blah.
....

// feed-UserC.xml
UserA flew a kite.
UserY blah blah blah.
....

this is like pubsub (I think). I don't need it to be realtime though. I'm not sure how the case of many followers is handled. If a user has 1 million followers, doesn't the hub have to sit there and notify all 1 million subscribers? If the hub is run on a single server, this could tie up the cpu for a long time, right?

Thanks

A: 

What you need to know is whether you have a situation with many subscribers to a few publishers or a more evenly distributed solution with few subscribers to many publishers.

If this is the former, it may not be smart to write all XML files when A updates, but just generate "upon" demand, assuming that the demand in question will be low enough so that you don't have to generate all the X,Y,Z files for each of A's updates. This would be called : updates on reads.

If this is the latter, then, you're approach is better : updates on writes : you build X, Y and Z's every time A updates.

Julien Genestoux
Makes sense, thank you.