Skip to content
SD-46 · Back to the write-up

Design a On-Call Escalation

Append alerts to a log, dedupe them into incidents per partition, and let a durable timer service drive escalations through the same log.

Follow a request

Outside
Intake
Incident core
Data and delivery
Monitoring toolsAlert senders
On-call engineerApp, SMS, call
Event APIAppend, 202
Event logBy service
Schedule serviceWho is on call
ProcessorsDedupe, escalate
Timer serviceBy due minute
Incident DB8 shards
NotifierRetry, fail over
ProvidersSMS and voice × 2
1sources → api · POST /v1/eventsA monitor sees checkout errors and sends a trigger event with dedup_key = checkout-5xx.1 / 9

The numbers, at a glance

In a storm, for every incident……about 100 events arrive
1 incident ≈ 2,000/s99 duplicates ≈ 198,000/s
Load jumps when it mattersAlert events per second
Provider headroom in a storm4,000 sends a second across 2 providers
One provider alone allows 3,000 a second, so a storm needs both.

Alert to first page, in order

A new incident. A duplicate stops at the processor; an escalation starts at the timer service.

Monitor
Event API
Event log
Processor
Incident DB
Schedules
Timers
Notifier
1 POST /v1/events
2 append (2 of 3)
3 202
4 read partition 17
5 INSERT incident
6 on call now?
7 Ana
8 set +5 min
9 page Ana
10 timer_due (later)
RequestResponseAsync, does not block

How escalation timers fire

The decision this question is really about.

Poll the database
Fine at first
every 15 s
SELECT all overdue
1M open → 67K rows/s
+ Simple; state in one place.− Scans grow with open incidents; one poller.
Timers in memory
Loses pages
schedule(5 min)
deploy restarts process
nobody escalated
+ Exact and cheap.− A restart loses them.
Durable timer service
Our pick
set timer → store
read due minute
timer_due → incident partition
+ Survives crashes; ordered with acks.− One more service to run.

How it grows

Add a box only when a number forces you to. Highlighted boxes are new at each stage.

Stage 1 · ≈ 100 events/sMake it work
Monitors
App serverEscalation poller
DatabaseSMS provider
One server writes events and sends SMS; a poller escalates.
Stage 2 · ≈ 10,000 events/sSurvive storms
Monitors
Event API
Event log
ProcessorsEscalation poller
Incident DBSMS provider
Append to a log, dedupe in processors before the database.
Stage 3 · ≈ 50,000 events/sNever miss a page
Monitors
Event API
Event log
ProcessorsTimer serviceSchedules
Incident DBNotifier2 providers
Durable timers, cached schedules, a notifier with two providers.
Stage 4 · ≈ 200,000 events/sScale and verify
MonitorsHeartbeat monitor
Event API
Event log
ProcessorsTimer serviceSchedules
Incident DB · 8 shardsNotifier2 providers
8 shards by account and an outside heartbeat.
Was this walkthrough useful?Your vote tells us what to improve next.