Each user uses 50GB
10,000,000 users
500,000,000 GB total storage --> 500 Petabytes
10% users active per day reading and uploading
1,000,000 uploads per day --> 41k per hour -> 683 per minute -> 12 per second
10,000,000 reads per day
CreateFolder
ListFolder
UpdateFolder
DeleteFolder
/* or one at a time, b/c limiting factor is the upload. Client can rate limit how many parallel uploads to support */
RequestUpload
CreateFile
GetFile
UpdateFile
DeleteFile
folders table
_id
parent_folder_id
user_id
name
metadata
primary key _id
items table
_id
parent_folder_id
user_id
name
other metadata
unique index on (parent_folder_id, name)
primary key _id
users table
_id
auth0_user_id
...
Database used for object metadata. Actual files stored in Cloud Object Store (something like S3).
Common queries
Use authN/authZ service (like auth0). On successful client token creation, create a record in our own user table if one doesnt exist.
Load balancer for horizontal scaling and zero downtime deploys
(potentially separate service) API gateway to validate authorization token.
Application server
Database
Cloud object store (i.e. S3) for cheap storage
No CDN for file uploads
But can use CDN for webapp resources
CreateFile
What happens if createFile fails?
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...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?