External:
User Table:
Post Table:
We could shard the database by time of day the post was last updated
Because a post is most likely posted once and then read multiple times,
this system would likely be ready heavy
User sends request
Request is distributed to servers through the loadbalancer
For get requests we could check the cache (LRU cache to store top 20% of posts visited) and if cache miss then try grabbing from DB
For post requests we would store the text in S3 and then store the post data in the posts DB
Client -> Load Balancer -> Server -> Cache -> DB -> Back to user
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Bottle neck may be that there could be a spike of posts -> we shard the DB for this
Bottle neck may be that when there are too many posts in the DB, there is a delay to finding the right post to send back to use -> we shard and use replicas