Part 8 of 8 · 2 min read
Exercises
Easy
Easy 1: Daily storage (20 minutes)
2 million DAU, 5 per cent upload one 500 MB video a day. How much new original data a day?
Done when: you write 100,000 uploads and 50 TB.
Hint
2,000,000 × 5% = 100,000.
Easy 2: CDN bill (20 minutes)
2 million DAU watch 4 videos of 0.25 GB each a day at $0.02 per GB. What is the daily CDN cost?
Done when: you write 2,000,000 GB and $40,000 a day.
Hint
Videos times size gives GB, then multiply by price.
Easy 3: Resume an upload (20 minutes)
A 20-minute video is split into 10-second chunks. The upload fails after 45 chunks. How many chunks remain?
Done when: you write 120 chunks in total and 75 remaining.
Hint
20 minutes is 1,200 seconds.
Medium
Medium 1: Draw the upload flow (30 minutes)
Draw the upload flow with all components named in this page. Mark the two parallel branches.
Done when: a diagram with at least ten parts, numbered steps and two branches.
Hint
The metadata branch does not wait for the file.
Medium 2: Long-tail saving (30 minutes)
Using $150,000 a day with all views on the CDN, what is the CDN cost if only the videos that give 70 per cent of views go there? What other cost appears?
Done when: you write $105,000, and a note that the other 30 per cent is served by storage servers that also cost money.
Hint
Take 70 per cent of $150,000.
Medium 3: Parallel stages (30 minutes)
Stage 1 takes 3 minutes. Stage 2 has video encoding (12), thumbnail (2), audio encoding (4) and a watermark (5). Give the time in series and in parallel.
Done when: you write 3 + 12 + 2 + 4 + 5 = 26 minutes, and 3 + 12 = 15 minutes.
Hint
In parallel, the longest stage 2 task decides.
Hard
Hard 1: Draw a DAG (60 minutes)
Write a DAG for a creator who wants a watermark on all versions, a custom thumbnail, and 360p, 720p and 1080p outputs. Show stages and parallel tasks.
Done when: a graph with stages, arrows and a note of which tasks run at once.
Hint
Watermark can be applied before or after encoding. State your choice.
Hard 2: Cost plan (60 minutes)
Make a plan to cut the CDN bill in half for a service with the numbers of this page. Choose from the four ideas, give the estimated saving of each and the risk.
Done when: a table with each idea, a saving in dollars per day and a risk.
Hint
A saving idea that lowers views on the CDN also raises other costs.
Hard 3: Mock interview (60 minutes)
Answer "design a video streaming service" aloud in 35 minutes and mark yourself on the four steps. List two missed topics.
Done when: a recording, a score on each step, and two named gaps.
Hint
Use the four-step framework as a checklist.