Durable Webhook Delivery
0ledger rows
- Sender says
- Attempts
0ms healthy p99
- Failing queue
- Healthy queue
Recorded
Details
A receiver records an expense, then the response is lost. The sender cannot tell this from a request that never arrived, so it has to try again. Retry blindly and the expense is recorded twice. Do not retry and it can be lost.
No sender can solve this alone. So this project defines what a receiver must do, builds both sides, and then tries to break them on purpose.
Results
A clean result only means something if the test could have failed. So each claim below is paired with a control that must fail. The plan was committed before the runs, and the tests that failed are shown here too.
- 30 minutes at 1,000 events per second
- p99 63 to 71 ms, 1,800,000 effects reconciled250 ms budget
- 2,000 per second, 60 second runs
- p99 86 to 94 ms with 4 workers2,500 per second failed the rule
- 2,000 per second, ten minute runs
- Failed twice, with a p99 of 1,099 to 1,497 ms and then 378 to 3,881 ms, though all 7,200,000 effects reconciled250 ms budget
- 75 workers killed on purpose, 185,200 deliveries
- 0 repeated, 0 missingNaive receiver: 50 of 50 planted repeats found
- 100,000 events, 20,000 duplicates, 30 crashes
- 0 repeated, 0 missingNaive receiver: 50 of 50 planted repeats found
- 5 primary failovers
- 0 acknowledged events lostAsync replication lost 196 to 273
- Slow destination isolation
- Passed its retest at a p99 of 58 to 67 ms, after the first attempt failed at 59 to 642 msLimits off: 34,899 to 36,945 ms
- Lease protocol, TLA+
- 9,484,492 states, no violation4 of 4 broken designs caught
- Test suite
- 39 of 39 mutants caughtEach mutant removes one rule
The outage
One destination turned slow for 60 seconds while another tenant kept sending. This is the median of three retest runs. Per-destination limits held the healthy tenant's p99 at 61 ms. With them removed it reached 36,317 ms, about 599 times worse. The failing destination caught up 25 seconds after it recovered. The first attempt at this test missed the 250 ms budget in 2 of 3 runs, because of one second stalls that also hit before the outage began.
How it holds
- Commit first
- Nothing is sent before it is durable A worker commits its lease before the request leaves, so a crash at any line can be recovered.
- Lease tokens
- A late worker cannot change anything Each claim gets a new token. A worker that wakes after its lease ended is recorded, and ignored.
- Delivery keys
- One key, across every retry The receiver commits the key and the expense in one transaction, so a resend finds the key and writes nothing.
- Isolation
- One bad destination stays contained Limits are derived from leased rows, so a crash cannot leave them wrong, and a breaker stops wasted attempts.
- Failover
- An acknowledged event outlives its primary With synchronous replication, ingress answers only after the standby has the commit.
Limits
- All numbers were measured on one Apple M5 Pro Mac, with PostgreSQL 17 flushing the drive cache on every commit. The load generator, engine, receiver and databases shared that machine and one drive, and other work ran on it too.
- The cause of the stalls at 2,000 per second was not found. A drive flush probe stayed fast through the retest, so a slow flush does not explain them there. A rate that holds for 60 seconds and fails at ten minutes is a real finding.
- The fault model is process death, lost responses and pauses. Power loss was not tested, and the failovers share one machine, so they say nothing about a data centre failure. Promotion is triggered by the harness, with a declared 2 second detection time.
- The crash and the naive case are different faults, so their retry times should not be compared. The naive case is the receiver's log for one event, which holds no worker or sender times, and its amount comes from the run's seed.
- The kill has no timestamp of its own, so the lost acknowledgement sits between two recorded steps. The stage stretches the first milliseconds and shortens the waits, while its clock shows recorded time.
- This is an offline replay of recorded runs. All data is synthetic.
Method
The plan, the runs and every failed test are in the report, and the results are in the repository.
Recordings
Every step of the crash
- +0 ms, engine
- event evt-2026-266 and its delivery committed, then ingress answered 202
- +10 ms, worker
- worker-7 committed lease e9922f45 for attempt 1 before sending
- +32 ms, receiver
- attempt 1: key and expense committed together
- +3.09 s, engine
- lease e9922f45 expired with no report from worker-7
- +6.71 s, worker
- worker-17 committed lease b975bc0c for attempt 2 before sending
- +6.72 s, receiver
- attempt 2: key already present, no new effect
- +6.72 s, worker
- attempt 2 recorded as success with status 200
Every step of the naive case
- +42 ms
- attempt 1: expense written
- +42 ms
- attempt 1: response dropped after the write
- +81.49 s
- attempt 2: expense written
The outage, second by second
| Second | Healthy queue | Failing queue | p50 ms | p99 ms | Events |
|---|---|---|---|---|---|
| 1 | 14 | 11 | 37.3 | 52.1 | 308 |
| 2 | 13 | 10 | 39.7 | 54.5 | 289 |
| 3 | 22 | 17 | 40.1 | 54.2 | 303 |
| 4 | 9 | 11 | 35.8 | 47.0 | 279 |
| 5 | 14 | 13 | 34.8 | 47.9 | 292 |
| 6 | 13 | 18 | 39.7 | 61.4 | 301 |
| 7 | 14 | 16 | 37.4 | 53.5 | 310 |
| 8 | 12 | 22 | 37.3 | 47.9 | 296 |
| 9 | 10 | 7 | 35.9 | 51.2 | 285 |
| 10 | 14 | 14 | 38.9 | 57.9 | 274 |
| 11 | 20 | 17 | 35.0 | 45.7 | 318 |
| 12 | 22 | 10 | 35.6 | 46.6 | 300 |
| 13 | 17 | 9 | 37.5 | 52.9 | 299 |
| 14 | 12 | 13 | 36.1 | 51.9 | 294 |
| 15 | 18 | 15 | 35.5 | 49.7 | 266 |
| 16 | 14 | 21 | 35.6 | 49.3 | 297 |
| 17 | 13 | 14 | 37.7 | 53.8 | 286 |
| 18 | 13 | 16 | 35.3 | 47.5 | 277 |
| 19 | 12 | 10 | 35.6 | 45.5 | 313 |
| 20 | 20 | 8 | 38.3 | 53.0 | 309 |
| 21 | 13 | 160 | 34.4 | 46.3 | 295 |
| 22 | 9 | 463 | 34.3 | 48.7 | 289 |
| 23 | 11 | 746 | 35.2 | 49.8 | 267 |
| 24 | 9 | 1042 | 35.3 | 50.1 | 266 |
| 25 | 11 | 1362 | 35.0 | 51.1 | 308 |
| 26 | 14 | 1682 | 34.4 | 47.4 | 310 |
| 27 | 7 | 2007 | 36.9 | 51.3 | 280 |
| 28 | 9 | 2334 | 38.5 | 54.5 | 266 |
| 29 | 12 | 2614 | 36.4 | 51.3 | 307 |
| 30 | 4 | 2892 | 36.4 | 52.6 | 272 |
| 31 | 8 | 3199 | 39.1 | 59.3 | 290 |
| 32 | 17 | 3509 | 36.4 | 50.3 | 302 |
| 33 | 13 | 3822 | 36.5 | 51.1 | 291 |
| 34 | 16 | 4128 | 37.6 | 50.2 | 301 |
| 35 | 19 | 4409 | 40.0 | 57.7 | 319 |
| 36 | 10 | 4701 | 37.1 | 54.4 | 304 |
| 37 | 7 | 4997 | 34.1 | 49.4 | 322 |
| 38 | 15 | 5279 | 40.4 | 62.5 | 320 |
| 39 | 16 | 5599 | 33.2 | 51.9 | 276 |
| 40 | 20 | 5892 | 33.9 | 46.8 | 319 |
| 41 | 16 | 6148 | 33.4 | 45.1 | 291 |
| 42 | 9 | 6461 | 38.0 | 67.7 | 299 |
| 43 | 11 | 6756 | 37.5 | 51.6 | 303 |
| 44 | 10 | 7066 | 34.3 | 55.8 | 276 |
| 45 | 15 | 7366 | 36.5 | 52.0 | 279 |
| 46 | 22 | 7633 | 44.9 | 78.1 | 292 |
| 47 | 18 | 7956 | 33.6 | 48.3 | 299 |
| 48 | 9 | 8255 | 35.6 | 49.1 | 302 |
| 49 | 20 | 8554 | 39.4 | 58.3 | 282 |
| 50 | 11 | 8822 | 36.3 | 48.8 | 291 |
| 51 | 16 | 9122 | 34.1 | 51.9 | 303 |
| 52 | 24 | 9406 | 35.2 | 48.5 | 315 |
| 53 | 12 | 9682 | 35.4 | 48.9 | 285 |
| 54 | 6 | 9966 | 32.6 | 49.4 | 257 |
| 55 | 13 | 10255 | 34.0 | 48.9 | 288 |
| 56 | 14 | 10542 | 40.1 | 65.1 | 292 |
| 57 | 15 | 10840 | 38.8 | 55.1 | 278 |
| 58 | 3 | 11173 | 38.4 | 55.4 | 301 |
| 59 | 15 | 11447 | 39.1 | 56.0 | 295 |
| 60 | 20 | 11781 | 40.7 | 66.6 | 316 |
| 61 | 17 | 12074 | 39.4 | 58.6 | 332 |
| 62 | 15 | 12367 | 37.2 | 54.9 | 311 |
| 63 | 22 | 12676 | 41.0 | 61.0 | 323 |
| 64 | 12 | 12989 | 41.7 | 65.2 | 313 |
| 65 | 14 | 13272 | 39.4 | 63.6 | 266 |
| 66 | 16 | 13578 | 44.3 | 70.3 | 296 |
| 67 | 12 | 13867 | 46.6 | 74.7 | 288 |
| 68 | 19 | 14173 | 44.9 | 69.9 | 316 |
| 69 | 11 | 14460 | 38.1 | 52.1 | 274 |
| 70 | 4 | 14789 | 38.5 | 55.6 | 317 |
| 71 | 14 | 15103 | 41.9 | 60.2 | 292 |
| 72 | 18 | 15398 | 39.5 | 63.2 | 293 |
| 73 | 11 | 15699 | 36.4 | 51.1 | 307 |
| 74 | 11 | 15979 | 39.3 | 55.1 | 304 |
| 75 | 13 | 16293 | 39.8 | 61.4 | 298 |
| 76 | 10 | 16567 | 38.6 | 56.4 | 321 |
| 77 | 8 | 16858 | 40.1 | 63.8 | 280 |
| 78 | 13 | 17143 | 44.8 | 64.0 | 318 |
| 79 | 10 | 17424 | 42.4 | 63.7 | 308 |
| 80 | 16 | 17703 | 36.2 | 51.4 | 281 |
| 81 | 11 | 18016 | 37.4 | 54.1 | 301 |
| 82 | 25 | 18325 | 37.2 | 52.5 | 313 |
| 83 | 13 | 18613 | 36.3 | 49.8 | 288 |
| 84 | 13 | 18900 | 38.8 | 54.0 | 319 |
| 85 | 12 | 17962 | 44.3 | 65.6 | 265 |
| 86 | 18 | 17146 | 41.7 | 69.5 | 321 |
| 87 | 14 | 16285 | 40.9 | 65.5 | 279 |
| 88 | 8 | 15375 | 43.4 | 64.0 | 292 |
| 89 | 11 | 14543 | 42.1 | 59.7 | 283 |
| 90 | 8 | 13540 | 39.1 | 53.2 | 296 |
| 91 | 13 | 12526 | 40.1 | 55.6 | 264 |
| 92 | 25 | 11631 | 42.0 | 63.9 | 296 |
| 93 | 15 | 10739 | 41.4 | 56.5 | 312 |
| 94 | 16 | 9855 | 40.8 | 53.9 | 275 |
| 95 | 11 | 8893 | 41.8 | 55.8 | 306 |
| 96 | 22 | 8035 | 43.7 | 62.2 | 305 |
| 97 | 13 | 7164 | 43.5 | 63.6 | 328 |
| 98 | 8 | 6382 | 44.2 | 62.2 | 322 |
| 99 | 10 | 5424 | 38.7 | 55.5 | 321 |
| 100 | 15 | 4464 | 37.6 | 53.0 | 314 |
| 101 | 18 | 3469 | 36.2 | 47.0 | 318 |
| 102 | 0 | 2350 | 0.0 | 0.0 | 0 |
| 103 | 0 | 967 | 0.0 | 0.0 | 0 |