The total number of users = 500 million.
Total number of daily active users = 100 million
The average number of files stored by each user = 200
The average size of each file = 1 MB
Total number of active connections per minute = 1 million
Storage Estimations:
Total number of files = 500 million * 200 = 100 billion
Total storage required = 100 billion * 1 MB = 100 PB
Considering 1 server can handle 1000 requests concurrently, we would need 1 Million / 1000 = 1000 servers
User Authentication API:
2. File Upload API:
3. File Download API:
4. File Management API:
5. File Synchronization API:
6. Sharing and Collaboration API:
7. Version Control API:
8. File Search API:
For the tables required in this design, refer to the class diagram, the list of classes is not exhaustive but this is a good number of tables to start with.
Database Choice
Data Partitioning:
Regional or Geographical Partitioning:
Sharding Strategy:
Sharding Key Selection:
Replication:
Load Balancing:
Let's break down the high-level design into various components
The below sequence diagram shows the flow of users uploading and sharing a file.
Let's talk about what happens on the client side when a user uploads or modifies a file.
When the user updates an existing file or creates a new file in the folder selected for synchronization and backup the below components come into play.
Although there are multiple components on the server side we will discuss the below important components which are essential for our current design.
Let’s now discuss how we can handle version conflicts in a collaborative file editing scenario ensuring data integrity and making sure that users are notified when their file is being updated by their collaborators.
Client-side :
Server-Side
Conflict Resolution Strategies:
Although we have discussed a lot of things below are 3 things that we can explore to further improve our design
Try to discuss as many failure scenarios/bottlenecks as possible.
Enhanced File Versioning System:
Optimized Chunking Algorithm:
Intelligent Conflict Resolution Mechanism:
Global File Deduplication: