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
Alert to first page
A duplicate event
Nobody acks: escalate
Acknowledge
A provider fails
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
dedup_key = checkout-5xx.1 / 9The numbers, at a glance
1 incident ≈ 2,000/s99 duplicates ≈ 198,000/s
5.8K/sAverage
20K/sBusy hour
200K/sStorm
4,000 sends/s6,000/s with 2 providers
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.
every 15 s
SELECT all overdue
1M open → 67K rows/s
+ Simple; state in one place.− Scans grow with open incidents; one poller.
schedule(5 min)
deploy restarts process
nobody escalated
+ Exact and cheap.− A restart loses them.
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.
Monitors
App serverEscalation poller
DatabaseSMS provider
Monitors
Event API
Event log
ProcessorsEscalation poller
Incident DBSMS provider
Monitors
Event API
Event log
ProcessorsTimer serviceSchedules
Incident DBNotifier2 providers
MonitorsHeartbeat monitor
Event API
Event log
ProcessorsTimer serviceSchedules
Incident DB · 8 shardsNotifier2 providers
Was this walkthrough useful?Your vote tells us what to improve next.