Upload
phu-luong-trong
View
108
Download
1
Tags:
Embed Size (px)
Citation preview
ltSOCIAL NETWORK ARCHITECTUREgtDEV ZONE
Overview architecture
Web Apps
Web Service APIs
Mobile Apps
4 Front-end
SSOUser
ranking
1 Core User
User Data Storage
Real-time Notification
News Feed
2 User Activity System
User Activity Storage
3 Others
Real-time Chat
Search System Suggestion System
3 Big Data System
Big Data Storage
hellip
External Apps
Service Data
UserAdministrator
Core User
1 Core User
bull SSO (Single sign on system)
bull User ranking
bull User administrator system
bull User data storagebull User info
bull Action Log
bull Relation follower followee family
SSOUser
Ranking
User Data StorageService
Data
UserAdministrator
1 Core User SSO System
bull Registry service with SSO systembull Service ID
bull Service Name
bull Service Description
bull hellip
bull Private Key
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
Overview architecture
Web Apps
Web Service APIs
Mobile Apps
4 Front-end
SSOUser
ranking
1 Core User
User Data Storage
Real-time Notification
News Feed
2 User Activity System
User Activity Storage
3 Others
Real-time Chat
Search System Suggestion System
3 Big Data System
Big Data Storage
hellip
External Apps
Service Data
UserAdministrator
Core User
1 Core User
bull SSO (Single sign on system)
bull User ranking
bull User administrator system
bull User data storagebull User info
bull Action Log
bull Relation follower followee family
SSOUser
Ranking
User Data StorageService
Data
UserAdministrator
1 Core User SSO System
bull Registry service with SSO systembull Service ID
bull Service Name
bull Service Description
bull hellip
bull Private Key
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
Core User
1 Core User
bull SSO (Single sign on system)
bull User ranking
bull User administrator system
bull User data storagebull User info
bull Action Log
bull Relation follower followee family
SSOUser
Ranking
User Data StorageService
Data
UserAdministrator
1 Core User SSO System
bull Registry service with SSO systembull Service ID
bull Service Name
bull Service Description
bull hellip
bull Private Key
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User
bull SSO (Single sign on system)
bull User ranking
bull User administrator system
bull User data storagebull User info
bull Action Log
bull Relation follower followee family
SSOUser
Ranking
User Data StorageService
Data
UserAdministrator
1 Core User SSO System
bull Registry service with SSO systembull Service ID
bull Service Name
bull Service Description
bull hellip
bull Private Key
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User SSO System
bull Registry service with SSO systembull Service ID
bull Service Name
bull Service Description
bull hellip
bull Private Key
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User SSO System
bull Sign-up form httpsssoadayroinetsign-up
bull Forget-password form httpsssoadayroinetforget-password
bull User info amp update user info form httpsssoadayroinetuser[id]
bull Validate userbull Generate User validation OTP httpsssoadayroinetuid
bull Return JSONString uid otp
bull Validate user httpsssoadayroinetuidampotp
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User SSO System
bull Login Form httpsssoadayroinetloginsid=adrampsurl=httpadayroinetampdurl=httpadayroinetusersbull $sid Service ID $surl Source URL $durl Destination URL
bull Login redirection [durl]status=1ampui=Jw8HVYqmI4bJmAWQampactoken=4bJmAWQbull $status 1 - login successfully 0 - login failed
bull $ui user info user_id avatar_path username login_time IP encrypted by DES (Triple DES) RSA
bull $actoken access token with expired time
bull Check login httpsssoadayroinetloginsid=adrampsurl=httpadayroinet
bull Logout httpsssoadayroinetlogoutsid=adrampsurl=httpadayroinet
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User SSO System
bull Login API -XPOST httpsssoadayroinetloginbull Params sid username password
bull Return JSONString as Login redirection
bull Get user Info API httpsssoadayroinetuser-info[id]bull Require Login
bull Return JSONString user_id username avatar_path login_time last_login_time last_login_IP
bull User action API httpsssoadayroinetuser-actiontypeampdatabull Require Login
bull Return JSONString status
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User User administrator system
bull Summary
bull Violation (avatar info)
bull etchellip
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 CoreUser User Data Storage
bull User Info MySQL
bull User log MongoDBbull action user_id target_id target_type data created_at
bull User relation MongoDBfamily _id 1 uids [2 3]followee _id 1 uids [2 3] followee _id 2 uids [1 3] follower _id ldquo1rdquo uids [234] count 2000 next_page 2 follower _id ldquo1_p2rdquo uids [202320242025] count 10000 group_serviceID _id 1 gids [4 5]
bull Session Redisbull [user_infos][relations]hellip
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User Technology Problems amp Solutions
bull Load balancing
Gearman ZingMe News Feed
80M Users
3M Active usersday
15M actionsday
bull RESTful
PHP Laravel 5 (Java Spring RESTful)
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt
1 Core User Architect
Web ServerltJetty servergt
RESTful APIsltSpring RESTfulgt
Web Forms
Request Control
Gearman Server
WorkersControllers
CachingltRedisgt
DatabaseltMySQL
MongoDBgt