Part 8 of 8 · 2 min read
Exercises
Easy
Easy 1: Requests a second (20 minutes)
900 billion requests a month (30 days). Give the average a second and the peak at 3 times.
Done when: you write about 347,000 and about 1,040,000 a second.
Hint
900,000,000,000 / 2,592,000.
Easy 2: Origin load (20 minutes)
400,000 requests a second with a 97 per cent hit ratio. Give the origin requests a second. Then for 90 per cent.
Done when: you write 12,000 and 40,000.
Hint
Origin share is one minus the hit ratio.
Easy 3: Bandwidth (20 minutes)
200,000 requests a second at 150 KB each. Give the traffic in GB/s and Gbps.
Done when: you write 30 GB/s and 240 Gbps.
Hint
200,000 × 150 KB, then × 8 bits.
Medium
Medium 1: Cost (30 minutes)
1,200 TB a month at 2.5 cents a GB (1 TB is 1,000 GB). Give the monthly cost. Then with a cache that cuts traffic by 20 per cent.
Done when: you write 30,000 dollars and 24,000 dollars.
Hint
1,200 TB is 1,200,000 GB.
Medium 2: Shield (30 minutes)
60 regional caches each miss a new file once. Give origin requests with and without a shield, and the share saved.
Done when: you write 60 and 1, and about 98.3 per cent saved.
Hint
One minus 1/60.
Medium 3: Cache key (30 minutes)
A URL has parameters size, format and utm_source. Say which belong in the key and why. Give the effect of keeping utm_source if 50 sources exist.
Done when: a rule keeping size and format, ignoring utm_source, and the 50 times fragmentation.
Hint
Ask whether the content changes with the parameter.
Hard
Hard 1: Draw the layers (60 minutes)
Draw users, DNS, edges, regional caches, shield and origin. Number a request that misses at every layer, and one that hits at the edge.
Done when: a diagram with at least 6 parts and two numbered paths.
Hint
A miss passes down one layer at a time.
Hard 2: Purge system (60 minutes)
Design a purge that reaches 150 PoPs within 5 seconds. Say how it is sent, confirmed and retried.
Done when: a design with a publish channel, per-PoP acknowledgement, a retry rule and a status report.
Hint
Think of a message to all PoPs and a reply from each.
Hard 3: Capacity with failover (60 minutes)
A region has 4 PoPs sharing a peak of 600 Gbps equally. If one fails, the other 3 take its load. Give the capacity each PoP needs and the spare percentage.
Done when: you write 200 Gbps per PoP after failure, with 150 Gbps normally, so 33 per cent more than normal.
Hint
600 / 3 against 600 / 4.