Part 8 of 8 · 2 min read
Exercises
Easy
Easy 1: Write rate (20 minutes)
500 pools, 50 machines each, 80 metrics per machine, one point every 20 seconds. Give the series count and points per second.
Done when: you write 2,000,000 series and 100,000 points per second.
Hint
500 × 50 × 80, divided by 20.
Easy 2: Daily storage (20 minutes)
With 16 bytes per point and 100,000 points per second, give MB per second and GB per day.
Done when: you write 1.6 MB per second and 138.24 GB a day.
Hint
100,000 × 16 bytes, then multiply by 86,400.
Easy 3: Delta encode (20 minutes)
Encode timestamps 2000, 2010, 2020, 2031, 2041.
Done when: you write base 2000 and deltas 10, 10, 11, 10.
Hint
Subtract each timestamp from the next.
Medium
Medium 1: Downsample (30 minutes)
Turn these 10-second values into 30-second averages: 4, 6, 8, 10, 20, 30.
Done when: you write 6 and 20.
Hint
Average each group of three.
Medium 2: Fire or not (30 minutes)
A rule needs CPU above 80 per cent for 4 samples in a row. Samples: 70, 85, 90, 82, 88, 60. When does it fire and when does it resolve?
Done when: you write fires at sample 5 and resolves at sample 6.
Hint
Count four in a row above 80, starting from sample 2.
Medium 3: Roll-up storage (30 minutes)
10 million series, 16 bytes a point. Give the storage for 30 days at 1-minute resolution.
Done when: you write about 230 GB a day and 6.9 TB.
Hint
10,000,000 / 60 points per second, times 16 bytes, times 86,400, times 30.
Hard
Hard 1: Draw the pipeline (60 minutes)
Draw the full system with sources, collectors, queue, stream processor, database, query service, alert system and dashboards. Mark where data can be lost and how each is guarded.
Done when: a diagram with at least nine parts and a loss point list.
Hint
Loss can occur at the agent, the collector and the database.
Hard 2: Alert rules (60 minutes)
Write four rules for a web service: errors, latency, saturation and traffic drop. Give thresholds, waiting times and where each alert goes.
Done when: four rules with numbers and a reason for each waiting time.
Hint
A short waiting time suits errors, and a longer one suits saturation.
Hard 3: Mock interview (60 minutes)
Answer "design a metrics and alerting system" 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.