We need to support the following functionality:
Registrations, authorisation, notification functionalities are also very important, but we'll leave them out of scope for now.
We want the system to
Let's assume a tweet is ~70 characters long, so it takes about 140B of storage, and every now and then (let's say 1/5 of all tweets) users post a photo (~5MB) then will need
10 ^ 5 * 4 * 70 = 28MB of storage per day for text content right now and up to x20 later on when DAU base and their activity has grown.
10 ^ 5 * 5 * 10 ^ 6 = 5 * 10 ^ 11 = 500GB of storage per day for storing photos, which we can reduce by preprocessing and optimising the original files.
We'll need the following entities:
The most loaded is expected in Tweets DB, so we'll have it partitioned by user_ids and have a leader-follower replication in place.
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...
We can later add more capabilities to our system: