I want to implement a news feed where users can post both private ( shared ) and public activities. The difference between the two is public activities are shown in all the user's news feed and private activities are shown to all of my followers news feed.
I have been reading some resources about implementing news feed and I have come across this open source project.
Quoting from the documentation
Next up we want to start publishing this activity on several feeds. First of all we want to insert it into your personal feed, and then into your followers' feeds
Now this works well for private activities, I post the activity to author's own feed as well as all of my followers feed. But the issue is when the activity is public. In this case I have to post it to user's own feed as well as all other users in the system so that this activity is shown in their feed. Suppose there are 1 million users in the system than this will require posting to 1 million feeds (possibly 1 million DB records). I believe this is not correct.
I thought of separating out public activities in other collection and these activities are visible to all. This issue with this solution is suppose I want to retrieve a user's feed than how do I combine data from user's followers feed with public feed.
Consider this example.
User A has 10 followers and they posted 10 activities in total. So User A's feed has 10 activities from his followers. Now there is User B which user A does not follow. User B also posted 2 public activities. Now the user A's feed should have 12 activities (10 from followers + 2 from user B public activities) so I do I combine data from these two collection and implement sorting, filtering etc on the combined result set.
Additional Info: platform: node.js DB: rethinkdb
via Ritesh
No comments:
Post a Comment