Part 8 of 8 · 2 min read
Exercises
Easy
Easy 1: Send rate (20 minutes)
200 million users send 8 emails a day. Give the sends per second.
Done when: you write about 18,500 per second.
Hint
200,000,000 × 8 / 86,400.
Easy 2: Metadata size (20 minutes)
200 million users receive 30 emails a day at 50 KB metadata each. Give the daily metadata in TB.
Done when: you write 300 TB.
Hint
200,000,000 × 30 × 50 KB.
Easy 3: Attachment size (20 minutes)
Using the same 6 billion emails a day, 10 per cent carry an attachment of 400 KB. Give the daily attachment storage in TB.
Done when: you write 240 TB.
Hint
6,000,000,000 × 10% × 400 KB.
Medium
Medium 1: Queue growth (30 minutes)
Mail arrives at 80,000 a second for 10 seconds, and workers handle 50,000 a second. Give the queue length at the end of the burst and the time to drain at 50,000 a second with arrivals back to 20,000 a second.
Done when: you write 300,000 messages and 10 seconds (300,000 / 30,000).
Hint
30,000 a second of excess for 10 seconds.
Medium 2: Tables for queries (30 minutes)
List the queries for an inbox page, a message view, an unread filter and an attachment download. Give the table and key for each.
Done when: a table of four queries with partition and sort keys.
Hint
The partition key is always the user.
Medium 3: Bounce handling (30 minutes)
Say what the system does for a hard bounce, a soft bounce and a complaint.
Done when: three rules: stop sending and mark invalid; retry later with limits; stop and count against the sender's reputation.
Hint
Soft bounces are retried, hard ones are not.
Hard
Hard 1: Draw both flows (60 minutes)
Draw the send and receive flows with all parts and numbered steps, including the error path.
Done when: two diagrams with at least 8 parts each.
Hint
The queue sits between the web tier and the SMTP workers.
Hard 2: Search design (60 minutes)
Design the search for 100 million users with 10,000 mails each. Estimate the index size, and say how the index is updated.
Done when: a design with a size estimate, an update queue and a rebuild plan.
Hint
Index size is a fraction of the text size.
Hard 3: Warm-up plan (60 minutes)
A new sending IP must reach 1 million mails a day. Write a 4-week ramp plan with daily limits and the signals that pause it.
Done when: a week-by-week table with volumes and stop rules.
Hint
Start small and double only if complaints stay low.