Talk:Social Networking:Friends

From ExtractValue Wiki

Jump to: navigation, search

Wednesday, October 22, 2008 2:19 PM [2:19 PM] Austin Guu: hey G [2:19 PM] Austin Guu: didja get my email? [2:24 PM] Girish Patangay: how are you going to bring them all together? [2:24 PM] Girish Patangay: Keeping a steady stream of activities isn't the hardest thing... put it in a db, and generate everything off that db [2:25 PM] Girish Patangay: the hardest thing is the intelligence.. i.e. "top stories" type things [2:25 PM] Girish Patangay: which isn't really chronological etc [2:26 PM] Austin Guu: yes, i understand [2:27 PM] Girish Patangay: so if you were combining xml feeds, you would probably most likely toss it into a db anyway [2:27 PM] Austin Guu: so there's no special way to make a simple activity feed? [2:27 PM] Girish Patangay: and then serve it off there [2:27 PM] Austin Guu: got it [2:28 PM] Girish Patangay: [2:28 PM] Girish Patangay: db [2:28 PM] Girish Patangay: is the special way [2:28 PM] Girish Patangay: haha [2:28 PM] Girish Patangay: I mean, for each user, if they get "different feeds" based on their friends [2:28 PM] Girish Patangay: you could 1. create separate tables for each user [2:28 PM] Girish Patangay: 2. create APC or memcache entries for their feeds [2:29 PM] Girish Patangay: or some combination of both [2:29 PM] Girish Patangay: depends on how quickly you want to serve the data [2:30 PM] Austin Guu: and how do you make friends? [2:30 PM] Austin Guu: [2:30 PM] Girish Patangay: um, it's a social network [2:30 PM] Austin Guu: i'm trying to understand for myself [2:30 PM] Girish Patangay: oh [2:30 PM] Austin Guu: in laymen's terms, how do you structure a database to have friends [2:31 PM] Girish Patangay: um, in a db, you would have friend relationship entries [2:31 PM] Girish Patangay: for, example.. [2:31 PM] Girish Patangay: you have a "user" table with user_id [2:33 PM] Girish Patangay: sorry fedex came [2:33 PM] Girish Patangay: then you have a "friend" table or something -- or more correctly called "user_user" table [2:34 PM] Girish Patangay: which would have 2 user_id columns and then a "relationship type" column [2:34 PM] Girish Patangay: so you can put in user_id 1 is friends with user_id 2 relationship type is "good friends" [2:34 PM] Girish Patangay: then 2 can be friends with 1 with.. "awesome friends, he is my bff" [2:34 PM] Girish Patangay: then you have a map of the two users and how they are related [3:40 PM] Austin Guu: but you don't create a matrix for every user to every user, do you? [3:40 PM] Austin Guu: cuz if you have a million users, then it's a 1 mil x 1 mil matrix [3:40 PM] Girish Patangay: Yea? [3:41 PM] Austin Guu: are you serious? [3:41 PM] Austin Guu: so you're saying facebook has a 100 mil x 100 mil table? [3:41 PM] Girish Patangay: if you have your million users... a n to n isn't your biggest problem [3:41 PM] Girish Patangay: each user has thousands of actions [3:41 PM] Girish Patangay: which relate to other users sometimes [3:42 PM] Girish Patangay: so, yea, there are a lot of other things to do when you have 1 mill users [3:42 PM] Girish Patangay: but in theory, not all your users will be friends with everyone else [3:43 PM] Girish Patangay: so it's worst case it's 1 mill x 1 mill... but realistically it's like 1 mill * 100 * 2 [3:43 PM] Girish Patangay: 100 being the average number of friends a user has [3:45 PM] Austin Guu: unless your name is tom [3:45 PM] Austin Guu: then you have lots of friends [3:45 PM] Austin Guu: [3:45 PM] Girish Patangay: haha [3:45 PM] Austin Guu: so each user has their own table? [3:45 PM] Girish Patangay: um, at facebook? [3:45 PM] Girish Patangay: probably not [3:46 PM] Girish Patangay: but the "actions" are collected differently [3:46 PM] Girish Patangay: we collect billions of actions a day [3:46 PM] Austin Guu: i'm confused [3:46 PM] Girish Patangay: action is what a user does [3:46 PM] Girish Patangay: i.e. click on a user's profile is an action [3:46 PM] Girish Patangay: some "activities" you defined are also actions [3:47 PM] Girish Patangay: they all get pooled [3:47 PM] Girish Patangay: and then karma is effected [3:47 PM] Girish Patangay: each user has a karma setting towards another user [3:47 PM] Girish Patangay: that's how usually the friends get ranked