Method – POST /login
Request – email and password
Response – token (JWT)
Method - POST /upload
Request – video file (chuncked upload), video metadata, JWT
Response – video_id
Method – GET /video/{video_id}
Request – video_id, token (JWT)
Response – video metadata, video file link
Method – GET /search
Request – query, token (JWT)
Response – array of video_id
Table for storing users data
Table for storing videos metadata
All the components of the design are scalable enough for the non-functional requirements
S3 storage is highly scalable. We will have 300 TB of video files data so the database must be distributed over many nodes. And it will work well on scale
The services are stateless. So they can be horizontally scaled well
These databases will handle big amount of requests. But they have not so many data.
To handle the amount of requests we can use asynchronous replication. This will increase the response speed and availability of the components.
Elasticsearch is design specially for big data and it is higly scalable.
We will use S3 because we have a huge amount of big files and the storage must be highly scalable. And it is okay to retrieve them with just their names (uuid).
CDN will make the files load much faster because of files caching and geographical distribution
I decided to use PostgreSQL because we have not so big amount of metadata. And using relational database will make us much more flexible
Most parts of the system are stateless and independent that makes the system highly available. But there are some edge scenarios
In case of failure of any replicas of the video metadata database the traffic will be easily directed to the different replica. But in case of database master failure we will have a little time, when the users will not be able to upload their videos. In a few seconds one of replicas may take the master place so the upload will start to work again.
Asynchronous communication between services may be added here. It will make the system even more scalable and available.
Functionality like comments, likes and subscriptions may be added in future.