architecture · Sep 24, 2026
Architecture Note: The Webhook Delivery Path
Five stages between an event and a customer's endpoint, what each one is allowed to fail at, and a token bucket that keeps one noisy tenant from starving the rest. Illustrative numbers throughout.

This is the architecture note we hand to anyone who joins the platform team and has to touch outbound webhooks. It describes one thing, the path an event takes from the moment our system produces it to the moment a customer's endpoint answers. The numbers are illustrative and rounded, not measurements of anything you can buy.
There is no diagram. A diagram implies the boxes are the point, and here the points are the arrows: what each stage is allowed to fail at.
The five stages
Read this table left to right as the path of one event.
Stage | Job | Budget p50 / p99 | Allowed failure |
|---|---|---|---|
intake | accept and persist the event | 4 ms / 20 ms | none; reject loudly |
match | find subscribed endpoints | 2 ms / 12 ms | fall back to a cached list |
limit | apply the per-tenant limiter | 1 ms / 4 ms | fail open |
queue | hold until a worker is free | 30 ms / 900 ms | delay, never drop |
dispatcher | call the customer's endpoint | 180 ms / 5 s | retry with backoff |
The budgets add up to a median of about 220 milliseconds from event to first attempt. The 99th percentile is dominated by the queue and by the customer's own server, which we don't control and shouldn't pretend to.
Where each stage is strict
Intake is the only stage that may say no to the producer. If an event can't be written to disk, nobody upstream should believe it was sent. Everything after intake works from a durable record, so the rest of the pipeline can fail, restart and retry without losing the event.
Match is forgiving on purpose. If the subscription lookup is down, a cached copy that's a few minutes old is better than silence. The worst case is one extra delivery to an endpoint that unsubscribed a minute ago, and we say so in the docs we give customers.
The limiter fails open. That's a deliberate trade: an outage in the limiter should cost us some fairness, not make every tenant's webhooks stop.
The limiter
One tenant that connects a bulk import to webhooks can generate ten thousand events a minute. Without a limit, the queue fills with their work and everyone else waits behind it. A token bucket gives each tenant a steady rate and a burst allowance.
class Bucket {
constructor(ratePerSec, burst) {
Object.assign(this, { ratePerSec, burst, tokens: burst, last: 0 });
}
take(nowSec) {
this.tokens = Math.min(this.burst, this.tokens + (nowSec - this.last) * this.ratePerSec);
this.last = nowSec;
if (this.tokens < 1) return false;
this.tokens -= 1;
return true;
}
}
const bucket = new Bucket(5, 10);
let accepted = 0;
let rejected = 0;
for (let i = 0; i < 40; i++) bucket.take(i * 0.05) ? accepted++ : rejected++;
console.log(`offered 40 in 2s: accepted ${accepted}, rejected ${rejected}`);Forty requests arrive over two seconds against a bucket with a rate of five per second and a burst of ten. It accepts 19 and rejects 21: the ten from the initial burst, plus about one more every 200 milliseconds as tokens trickle back.
Rejected here doesn't mean dropped. A limited event goes to the back of the tenant's own lane in the queue, so a flood slows that tenant down and nobody else.
Reading it as an operator
When a customer says their webhooks are late, start at the queue and look at that tenant's lane depth. If the lane is deep and the dispatcher's p50 is normal, they're being limited, which is working as designed. If the lane is shallow and the dispatcher's p99 is high, the problem is on their side of the wire, and the useful thing to send them is the delivery log.
Those two checks answer most of our support questions about late webhooks, and they exist because the architecture was written down as arrows.