Case study demo

Notification system

Fan a notification out to push, SMS and email channels through queues with retries.

An interactive demo of how this system behaves. It runs in your browser.

Case study · Live model

How a notification system behaves

Services ask one API to tell a user something. The notice waits in a queue, and a worker hands it to a push, email or SMS provider. Stop a provider, send events twice, or turn retries off, and watch who is told late, twice or never.

Try it

Lab time 3.0 s
senddeliverYour services, 10 events a secondYour services10 events a second10% are sent twiceNotification API, drops repeatsNotification APIdrops repeats0 repeats droppedPreferences, who wants whatPreferenceswho wants what2 not wantedQueues, one per channel, 0 waitingQueues, one per channel0 waitingPush 0 · Email 0 · SMS 0Workers, 2 of 6 busyWorkers2 of 6 busytry again, wait longerProviders, push, email, SMSProviderspush, email, SMSall answering
  • Your services — 10 events a second — healthy — 10% are sent twice
  • Notification API — drops repeats — healthy — 0 repeats dropped
  • Preferences — who wants what — healthy — 2 not wanted
  • Queues, one per channel — 0 waiting — healthy — Push 0 · Email 0 · SMS 0
  • Workers — 2 of 6 busy — healthy — try again, wait longer
  • Providers — push, email, SMS — healthy — all answering
  • An event, or a send to a provider
  • Check the user's settings
  • A notice in or out of a queue
  • A send that failed
Delivered
22/ 25
of the notices the API accepted
Told twice
0
the same notice reached a user again
Lost
0
failed once and not tried again
Set aside
0
failed 4 tries; a person must look
Tried again
1
sends that failed and went back to wait
Workers busy
2/ 6
2 for each channel

Numbers add up:28 arrived = 25 accepted + 0 repeats dropped + 2 not wanted + 1 on the way · 25 accepted = 22 delivered + 0 set aside + 0 lost + 3 waitingThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

Events
10 a second
10%

The API remembers each event's id and drops one it has seen before.

Queues and workers
Where notices wait

Push, email and SMS each wait in their own queue, with 2 workers each.

Up to 3 more tries, after 0.4 s, 0.8 s and 1.6 s. Off: a failed send is lost.

2%
Providers
Push
Email
SMS

A stopped provider gives no answer. A worker waits 2 s, then counts the send as failed.

Channel by channel

ChannelProviderWaitingWaitDeliveredSet asideLost
Pushanswering098 ms900
Emailanswering1289 ms900
SMSanswering2241 ms400

Wait is the time from the API accepting a notice to its delivery, over the last 3 seconds. If the oldest notice still in the queue has waited longer, that age is shown.

Wait by channel (seconds)
PushEmailSMS
00.10.30.40.51s2s3s
Show data table
TimePushEmailSMS
1s0.100.2
1s0.10.30.2
2s0.10.30.2
2s0.10.30.2
3s0.10.30.2
3s0.10.30.2

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • Half the notices are push, 3 in 10 email and 2 in 10 SMS. 10% are for a channel the user turned off, and the API drops them.
  • A provider here answers, fails 2 sends in 100, or stops. Real providers also slow down, limit how fast you may send, and fail for one country or one phone network.
  • A stopped provider costs a worker 2 s for each try. Real systems also stop sending to a provider that keeps failing, for a while.
  • A notice that is set aside stays there. In a real system a person, or a later job, looks at these and sends them again.
  • The API remembers event ids for 20 seconds. Real systems keep them for hours or days.
  • There is no order of importance: a password code waits behind a marketing notice. Real systems give urgent notices their own queue.