Most large social networks I know do not store their social graphs in relational databases, so thinking relationally doesn't scale here, period, especially if you want to do graph traversals.
If you are just looking for a way to check for network inclusion - I know of a large social network, that, in previous releases, stored each user's 1st degree network as a sparse array of bits. If a bit was 1, that described a connection. This was stored in-memory and consumed several megabytes per user. This worked for a while, but ultimately needed to be swapped out and rebuilt. On Sun, May 23, 2010 at 11:43 PM, MahatmaManic <[email protected]>wrote: > Big monster list! My app allows users to send requests to their > "network" which I am arbitrarily defining as 1st and 2nd degree > relationships. I assume I don't want to store it as a big monster list > for each user, but I do need to build it as efficiently as possible on > the fly. Thanks for the resources I will do some watching and reading, > and if you have any more advice I'm happy to soak it in :) > > Cheers > Ian > > On May 23, 10:40 pm, Robert Kluin <[email protected]> wrote: > > There are three very good sources of information about how to model > > stuff in the data store. This group is one place, > > I would also suggest reading this: > > http://code.google.com/appengine/articles/modeling.html > > And watching this: > > > http://sites.google.com/site/io/building-scalable-web-applications-wi... > > > > As far as you specific question goes, how do you want to use the list > > of friends? Are you planning to just put a monster list of everyone > > you know and everyone they know? Are you going to make the list > > paged, browseable, or searchable? > > > > I am sure I have seen some presentations / discussions related to > > modeling "networks" using the GAE and the datastore, but I can not > > find them at the moment. > > > > Robert > > > > > > > > > > > > On Sun, May 23, 2010 at 2:37 PM, MahatmaManic <[email protected]> > wrote: > > > I feel kind of silly about this, but I'm having trouble wrapping my > > > head around quite the right way to do something with the GAE > > > datastore. I think I know how I would do it with a classic relational > > > database, but... > > > > > I've got a model for a "user" which has a key_name of the user's id #. > > > One of the things I would like a user to be able to have is a list of > > > friends, which would be other users in the store. I'd like to have a > > > way to calculate a user's list of friends and friends-of-friends > > > efficiently. > > > > > I think in a traditional DB I would have a "friendship" table with a > > > user1 and user2 column, into which I'd first make a query for any > > > entries with columns matching my user's ID and take all the "other" > > > IDs to be my user's friends, then feed those back in for a second > > > round to get friends-of-friends. Then again I'm mostly a client guy > > > and what I just described may cause server/db people to weep or laugh > > > uncontrollably ;) > > > > > That said, I am just not clear on how I should be doing this with the > > > GAE datastore. I have some inkling that maybe I should be using a list > > > property to track a user's friends, and then do a query for all the > > > friends with ids that are in that list, and creating a Set of all > > > THEIR friend lists to get friends-of-friends? Am I thinking about this > > > the right way, or am I way off base? If that is correct am I going to > > > run into any result-limit/performance landmines if a user has a couple > > > hundred friends? If I'm way off base can anyone point the way? > > > > > I was never much good with DBs, and now it seems the small bits of > > > knowledge I've managed to scrape together are mostly useless, so any > > > advice folks can provide would be much appreciated. > > > > > Thanks! > > > > > -- > > > 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]<google-appengine%[email protected]> > . > > > For more options, visit this group athttp:// > 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]<google-appengine%[email protected]> > . > > For more options, visit this group athttp:// > 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]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- Ikai Lan Developer Relations, Google App Engine Twitter: http://twitter.com/ikai Delicious: http://delicious.com/ikailan ---------------- Google App Engine links: Blog: http://googleappengine.blogspot.com Twitter: http://twitter.com/app_engine Reddit: http://www.reddit.com/r/appengine -- 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.
