https://www.youtube.com/watch?v=3yW856jAbZA
Func req
Post tweet (text, video, photo)
Timeline (user timeline, home timeline)
Followers (users follow each other)
Read heavy app.
NFR
1 tweet: 10kb (?really?) for text, ~200kb is avg tweet
1B users, 200M DAU, avg each user has 200 followers
Storage: 100M tweets / day * 200kb = 20 Tb / day
rps: 100M / 100.000 sec = 1000 rps. in peak 5x = 5000 rps for write. Each this new tweet will be delivered to 200 followers => (5000*200) 1000.000 fan out messages
Network:
API
POST /v1/tweets (userId, content, media)
POST /v1/media
POST/DELETE /v1/users/userId/follow
GET /v1/timelines (userId, page, page size)
GET /v1/timelines/users/{userId} (page, page size)
DB design
Tweet: userId tweetId created_at content (including link to media) User relation: Follower_id Followee_id
Last updated