Pretty sure twitter does use c)

I think it called "fan out".


Overall its probably the most scalable - as you note a) is pretty hard-core.


However saying that using DataStore 'stringlists' could make it work
it pretty well. When someone makes a post, you add a string list
listing all their followers. Each post will have to store the whole
followers list.

Then to display someone's "inbox" you just run a query looking for all
posts with the user listed in the followers list.

- writing the post - will be expensive - due to all the index writes.
(2 per follower?) But ultimately that might be cheaper than writing a
whole entity to everyones inbox.

- and when someone gains or looses a follower you have to iterate
though their posts adding/removing the new user. (but compare that to
have to iterate though all their posts, and copy/remove all the posts
into the second users inbox)


... there probably is no perfect answer :)




On Wed, Feb 8, 2012 at 7:14 PM, Kaan Soral <[email protected]> wrote:
> I have searched "twitter" in this group and went back 1 year in posts but
> couldn't find anything but I remember a discussion like this before
>
> Problem:
> On both Twtter and FB, when you visit their Homepage, you see a summary of
> what your friends or interests are doing.
> You might have up to 1000 of these on average.
> How to combine this information?
>
> Some thinking:
> a) A naive approach would be to query for everyone, every time =
> impossible-ish
> b) To make this naive approach work we might determine popular friends of a
> user and achieve a query once, construct a callback for near time updates
> approach (to achieve real time info)
> c) Another approach is to not query at all but update everyone who are
> subscribed to a user, when that user posts an action
> This would work for FB I guess, but for Twtter, considering some people have
> 1Ms of followers, this may be a problem
> But the complexity is the sum of all followers over the network, and this
> number may be low, considering not everyone has that many followers, so this
> might be worth it
>
>
> I am leaning over the (c) method, what do you guys think, how would you
> implement these Social Networks?
> (I combined these 2 networks in the problem definition, but you may provide
> separate solutions)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/1WEnOApSj4sJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to