Why do you need FanOut when creating an activity feed?

I study the logics of creating an activity feed, similar to that on Facebook or the Twitter timeout.

There are many answers to StackOverlfow and Quora, as well as to other articles I found on Google that describe bloating reading or writing. All this makes sense. You record all the actions in one main table / collection of activities, and then at some point record a copy of this data to separate the corresponding tables for each user.

What I don’t quite understand is why there is a need for branching? That is, why is it necessary to record activity in individual user feeds? Is there a reason why you cannot use only one action table / collection? It will have corresponding indexes and have a valid user id. And then, when someone wants to see their activity flow, simply request an activity flow for the users that the current user corresponds to.

I understand that this may not be as effective as the actions are several times superior to the actual objects in the database. That is, there can be 100 messages in the database, but more than 1000 actions in the posts, so queries can be slow in the table / activity collection when the line numbers become quite high.

But didn't that work? Can't you just scale the database so that it can handle queries more efficiently? Is it really necessary for branching?

+4
source share
1 answer

You do not need to constantly disconnect, but the decision depends on many factors.

For example, Twitter does the same, but Facebook follows the fans.

, Facebook , Twitter. FB / /, " ". TAO (Graphing MySQL + Caching) .

0

All Articles