A payments platform notifies its business customers about events such as 'payment succeeded' or 'refund issued' by sending an HTTPS POST to a URL each customer registers. There are 20,000 customer endpoints and about 40 million events a day, peaking at 800 per second. Customer endpoints are often slow, return errors or go offline for hours during deploys. Every event must eventually be delivered or clearly reported as failed, and customers must be able to verify that a webhook really came from the platform.
Functional requirements
Customers register endpoint URLs and choose which event types they receive
Deliver each event to every subscribed endpoint as a signed HTTPS POST
Retry failed deliveries with exponential backoff for up to 3 days
Show customers a delivery log and let them replay events
Non-functional requirements
Producing services hand off an event in under 200 ms and never wait for customer endpoints
At-least-once delivery: no event is silently dropped
A slow or failing endpoint does not delay deliveries to other customers
Most events reach healthy endpoints within 5 seconds
Constraints and scale
40 million events a day, 800 per second at peak
20,000 customer endpoints with timeouts set at 10 seconds
Typically 1-3% of endpoints are failing at any moment
You will practise
Decouple event producers from slow consumers with a durable queue
Design retries with backoff, jitter and dead-lettering
Isolate tenants so one failing endpoint cannot exhaust shared workers
Show 2 hints
An endpoint that takes 10 seconds to time out holds a worker for 10 seconds. What happens if 500 events for it are queued ahead of everyone else?
Customers will receive some events twice. What can you give them so they can ignore duplicates?