What is Tilt
-
Tilt is video creation app(same as beReal), the app activates your phone's front and back cameras at the same time
User can select any stream (front or back) as major stream and other will be shown as smaller screen with major.
Requirements (CRUD)
Functional
Non-Functional
BOE
Metric | Description |
---|---|
QPS(Queries per second) | Very low, as in when someone opens app then request is sent to system and system sends the updates |
BW Estimates | |
Storage Requirements |
DAU = 1 Million. 1 user uploads 2 videos/day. Video duration = 10 min(100MB) Total video uploads = 1M x 2 = 2M. Data = 2M x 100MB = 200 TB /day. For 5 years = 200TB x 365 x 5 = 365 x 1015 bytes |
API Design (CRUD)
- REST API?
REST API Versioning(v1,v2)
1. User can create Account on tilt |
2. User reads timeline whenever he opens the app |
3. Update self profile |
5. User can create dualmode video & save on cloud |
5. Delete Account |
---|---|---|---|---|
|
|
|
User saves video in device library Directly send video to tilt server (in parts)
|
|
|
|
|
|
|
DB Schema
- Graph DB
// user Table
| userid (pk) | username | creation_timestamp | last_seen |
// password table
| userid (pk) | username | password_hash | password_creation_date | expiry_time |
-
Friends, friends of friends, Likes, comments, videos relationship Would be stored on Graph DB
Videos, Comments: Stored on seperate Object store
Coments:
HLD
User uploading video, Friend is notified and Friend watches video
@startuml actor user as u box datacenter participant "Load\nBalancer" as lb participant "App\nServer" as as database graphDB as gdb database userDB as udb database "ObjectStore\nAWS S3" as ostore #LightPink participant "Notification\nSender" as ns end box participant CDN as cdn actor friend_f1 as f note over u Create video end note note over udb Note last_seen time of user We will not send notification to user not active in last 7 days end note u -> lb: HTTP POST video lb -> as: HTTP POST video group Storing video on Object store as -> ostore: Store Video on Object Store ostore -> as: video URL as -> gdb: Create video node(url) end as -> ns: user_id=uid1\nuploaded video\nObject store ns -> gdb: Get all\nfriends of uid1 gdb -> ns: f1,f2 group Send notification to user active in last 7 days ns -> udb: Is friend active\nin last 7 days udb -> ns: Yes f1 ns -> cdn: video ns -> f: Notification\nUser1 has new\nVideo end group Friend Checks Video of uid1 note over f click to check video end note f -> ns: HTTP GET Video ns -> cdn: video note over cdn Video is cached end note cdn -> f: video end note over cdn Video is cached with deletion policy. if not read for 10 days delete end note @enduml |
Storing videos on CDN: All videos are not stored directly on CDN As user uploads a new video its stored on object store (e.g., AWS S3, Azure Blob Storage) CDN caches content only when requested by users. Videos are stored with proper lifecycle policies (e.g., auto-deletion after a period for inactive videos). Adaptive Caching Strategy on CDN: - Only store videos on the CDN when they cross a popularity threshold (e.g., number of views, likes, or shares). - Prioritize celebrity or influencer content for CDN storage due to higher demand - Implement a Least Recently Used (LRU) cache eviction strategy on the CDN to optimize storage costs. |