Loading...
Out of scope
Daily
Read request: 1 user * 20 Feed fetch requests
Write request: 1 user * 0.5 compost/share tweets, 2 like
Compost
POST/tweet -> tweet_id, body: {content: <>}
Share/Like
POST/tweet/share_or_like -> state, body: {tweet_id: id}
Feed fetch
GET/feed?pagenation -> tweet list
Follow
POST/follow -> state, body: {follower_id: id}
Diagram
User: id
Tweet: id, creator_id, content, create_time
Follower: id, user_id, follower_id, create_time
Share: id, tweet_id, user_id, create_time
Like: id, tweet_id, user_id, create_time
To support high scalability, we should shard the tweet db by user id.
To support the low read latency, we should add Redis cache or CDN to reduce the fetch time. Write the tweet content and follow relation to Redis after creation.