Total Storage
CND Storage:
Get Video Metadata
Upload Video
POST /api/v1/videosStream Video:
Search for video
Database Solutions:
CREATE TABLE videos_by_user (
user_id UUID,
video_id UUID,
upload_timestamp TIMESTAMP,
title TEXT,
description TEXT,
tags SET
video_url TEXT,
thumbnail_url TEXT,
PRIMARY KEY (user_id, upload_timestamp, video_id)
) WITH CLUSTERING ORDER BY (upload_timestamp DESC);
CREATE TABLE comments_by_video (
video_id UUID,
comment_timestamp TIMESTAMP,
comment_id UUID,
user_id UUID,
comment_text TEXT,
PRIMARY KEY (video_id, comment_timestamp, comment_id)
) WITH CLUSTERING ORDER BY (comment_timestamp DESC);
CREATE TABLE user_subscriptions (
user_id UUID,
subscribed_to_user_id UUID,
subscribed_timestamp TIMESTAMP,
PRIMARY KEY (user_id, subscribed_to_user_id)
);
CREATE TABLE video_analytics (
video_id UUID,
date DATE,
views_counter COUNTER,
likes_counter COUNTER,
PRIMARY KEY (video_id, date)
);
CREATE TABLE user_feed (
user_id UUID,
added_timestamp TIMESTAMP,
video_id UUID,
uploader_id UUID,
title TEXT,
thumbnail_url TEXT,
PRIMARY KEY (user_id, added_timestamp)
) WITH CLUSTERING ORDER BY (added_timestamp DESC);
Client Application
API Gateway
Media Services:
Data Services:
Cassandra Database
Blob Storage
CDN
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
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...
A trade-off we might want to consider is whether we want to employ tiered storage.
With tiered storage, we would store less frequently accessed or unpopular videos in less expensive storage tiers, such as cold storage solutions like AWS Glacier, while keeping high-demand videos in faster, more expensive storage.
This strategy would result in significant cost savings, especially given the large volume of videos uploaded daily. However, the trade-off would be higher latency when retrieving these videos from lower-cost storage. This could lead to a degraded user experience for viewers attempting to access videos stored in these tiers, as they might experience delays before playback begins.
Elastic Video Processing
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?