系统设计:登录系统 (account system)

1. User Scenario : Register/Update/Remove Login/Logout Balance/VIP/ProService
2. Constraints :
Assume 10,000,000 daily active user.
average login time: 1.2 (people may login multiple times per day).
100,000,000 DAU in 3 month.
Login: assume 15% user will login. 1,500,000
normal login frequency 1,500,000 / 24 * 2 (because most people will not login during night time etc..)
peak login in 3 * normal login frequency.
3. Data:
class User {
int userID //primary key
string name; (fixed length)
string password; (encrypted)
List sessionList
int state;
}

function insert, delete, update,
status(unverified, active, baned, inactive)

login/logout -> user need to logout after a period of time. login from pc and ipad

class Session {
int sessionID
int userID
int deviceCode; (ipad, pc)
long time_out
}

denormalize session List

Notice that Session and User are very similar, so we can use inheritance.

class Table {
private List table;
public function update
public function insert
public function remove
}

class SessionTable extends Table{
List table;
}

class UserTable extends Table {
List table;
}

proServeice/money: need to be protected by transaction.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s