Cheney
BAN USER
Propose an estimate based on msg operation
Publish: add msg to all the friend's msg list
GetNewsFeed: process all the msg attached to the user
Each user, there's a msg list
UserInfo {
MessageNode *msg_list;
FriendNode *friend_list;
}
void Publish(UserInfo user, string msg) {
// for each friend, insert msg into their msg list
foreach friend in friend_list
insert msg into User[friend].msg_list;
}
void GetNewsFeed(user) {
foreach msg in msg_list
process msg
}
Assume
user num: 1M
avg friend_num: 1k
msg/user/second: 0.001
Consider Publish
msg insertions per second: 1/user/second, 1M total insertions/second
Consider GetNewsFeed
user num: 1M
avg friend_num: 1k
msg read operation/second/user: 1
total msg read operations: 1M
2M total msg operations/second
Assume server capacity = 1k msg operations/ server
num of servers: 2k
Open Chat in New Window
Sounds quite reasonable, but could you please share some piece of the code, it's easier to read code sometimes
- Cheney March 30, 2013