← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 039 · Messaging and event-driven systems

Design Webhook Delivery

Medium 45 min

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
  1. 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?
  2. Customers will receive some events twice. What can you give them so they can ignore duplicates?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • A large customer's endpoint is down for six hoursA customer that receives 15% of all events has a failed deploy, and their endpoint returns 503 for six hours. Retries for their events pile up and delivery workers spend most of their time waiting on timeouts.

Run them from the workspace once your design is in place.