CSE Roadmap

Core tier · about 5 hours · 8 parts

Part 8 of 8 · 2 min read

Exercises

Easy

Easy 1: Total space (20 minutes)

20 million users each get 5 GB. What is the total space allowed?

Done when: you write 100,000,000 GB, which is 100 PB.

Hint

20,000,000 × 5 GB.

Easy 2: Upload rate (20 minutes)

4 million DAU upload 3 files a day each. Give average and peak (twice average) uploads per second.

Done when: you write about 139 and 278 per second.

Hint

12,000,000 uploads a day divided by 86,400.

Easy 3: Blocks (20 minutes)

A 100 MB file is split into 4 MB blocks. How many blocks? What size is the last one?

Done when: you write 25 blocks, with the last block 4 MB (100 divides evenly).

Hint

100 / 4.

Medium

Medium 1: Delta saving (30 minutes)

Three blocks of the 100 MB file change. How much is uploaded, and what share is saved?

Done when: you write 12 MB uploaded and 88 per cent saved.

Hint

3 × 4 MB, compared with 100 MB.

Medium 2: Draw the upload flow (30 minutes)

Draw both parallel requests with all components. Show the status change from pending to uploaded and the two notifications.

Done when: a diagram with numbered steps and the two status values.

Hint

The two requests start together from client 1.

Medium 3: Conflict timeline (30 minutes)

Write a timeline for two devices that edit version 3 offline and then sync. State each version number and the message each user sees.

Done when: a timeline with version 4 for the first, a conflict for the second, and version 5 after the merge.

Hint

The second device based its edit on an old version.

Hard

Hard 1: Version policy (60 minutes)

A document is saved 1,000 times in an hour. Design a version rule that keeps recent versions in detail and old ones thinly. Show how many versions are kept after a day.

Done when: a rule with numbers and a count of kept versions.

Hint

Keep every version for the last hour, fewer for the last day.

Hard 2: Sharding metadata (60 minutes)

Choose a shard key for the metadata database. Compare user id and file id. State what query gets slow with each choice.

Done when: a comparison table with a final choice and one slow query for each.

Hint

A shard key splits data, and queries that cross shards cost more.

Hard 3: Mock interview (60 minutes)

Answer "design a cloud drive" 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.