We assume 50k DAU. Assume each user has 100 GB storage, the storage requirement initially is 5PB. The Following storage requirement could be more than 20PB.
The key components are:
File upload flow: The file upload can be done through a socket protocol. To prevent file from missing when file service goes down, the uploaded file can be first store in the in-memory DB like Redis. Then the file can be written to persistent storage asynchronously.
File download could also be done through the socket protocol
Tech choices between 3rd party CDN and self-maintained file storage: it depends on cost: CDN is usually measured with data transmission; while self storage is more expensive with storage. So we can store the frequent visit files in self-maintained storage and store the large files in CDN.
File storage can have failures, so to prevent the file loss from failure, the file should be replicated.
File upload or download might be corrupted, so we need a checkSum mechanism to verify the data integration. During upload and download, if the action failed in the middle, we should fail the entire action to let user to retry.
We can improve the system to support upload/download pause in the middle. We can split the file into chunks and mark success for each chunk.