The interview problem

Practice prompt

A platform must deliver customer events to registered HTTPS endpoints, retry failures for up to 24 hours, and let customers investigate missed deliveries.

Candidate-reported topic adaptation: a public OpenAI interview account describes webhook delivery and a 24-hour retry window. Its interview date is not verified. This is an original solution, not a company answer key. Reviewed September 26, 2026. All workload numbers and acceptance thresholds below are illustrative practice assumptions.

1. Establish what delivery means

Ask whether an event has one destination or many, whether ordering is contractual, and whether endpoints belong to untrusted customers. Choose at-least-once delivery attempts within a deadline, with no global ordering. A successful HTTP response means the receiver accepted responsibility; it does not prove that its business action finished. A destination that stays unavailable for 24 hours can exhaust the delivery window.

In a 45-minute interview, spend 5 minutes on guarantees, 8 on API and state, 12 on the normal path, 12 on failures and capacity, and 8 on trade-offs. Begin with one region and a durable database plus workers; justify a broker when throughput or isolation requires one.

2. Store intent before sending

POST /events accepts a tenant-scoped idempotency key, event type and payload. In one transaction, insert the immutable event and delivery rows, one per destination. A repeated key with the same request returns the original event ID; a different body under the same key is a conflict. Only acknowledge intake after commit. If a broker is introduced, publish through a transactional outbox so database commit and queue publication cannot silently diverge.

A delivery row holds event ID, destination ID and configuration version, status, next attempt time, deadline, attempt count and lease generation. Workers claim due rows atomically. Every state update checks its generation so a worker whose lease expired cannot overwrite a newer result. Keep an attempt log with bounded response metadata; avoid storing secrets or arbitrary response bodies.

Event intake
Durable delivery state
Fair dispatch
Customer endpoint
Proposed logical flow; arrows do not imply atomic transactions. Durable state and failure boundaries are described above.

3. Calculate attempts, not just events

Assume 1,000 events/second, two destinations per event, and an observed mean of 1.2 attempts per delivery. The dispatch load is 1,000 × 2 × 1.2 = 2,400 attempts/second. At a mean 0.25-second request duration, approximately 600 requests are in flight in steady state. A five-second timeout during an outage can raise that to 12,000 without admission limits; the average is not a safe worker limit.

At 2 KB per event, raw payload storage is about 172.8 GB/day in decimal units, before replication, indexes and attempt logs. A full-day outage could accumulate 172.8 million delivery rows. Bound tenant backlog, keep payloads separately if needed, and monitor oldest pending age rather than queue size alone.

4. Walk through the ambiguous timeout

The receiver commits an action, but its response is lost. The sender must retry with the same event ID. The receiver needs a durable deduplication record committed with its local business update, or a downstream API that accepts an idempotency key. A sender lease cannot prevent duplicate external effects.

Retry transient failures using exponential backoff with jitter, a maximum attempt policy, and the remaining deadline. Interpret status codes through a documented contract; for example, 429 may provide a retry delay, while invalid credentials should trigger customer action. A paused destination must not consume all dispatch slots. Use tenant queues and destination concurrency limits to contain failures.

Sign the exact payload and timestamp, rotate secrets with overlap, and reject unsafe destinations at connection time. Restrict private/link-local networks, revalidate redirects or disable them, and account for DNS changes. These are required when customers control URLs; a one-time string validation is insufficient.

5. Ordering and replay are separate contracts

If strict per-account ordering is required, partition by account and serialize deliveries. One poisoned event then blocks subsequent events; negotiate whether to stop, skip with an explicit gap, or expose sequence numbers so consumers reconcile. A replay after expiry creates a new delivery attempt history but preserves the business event identity. Do not silently assign a new deduplication ID to the same business action.

6. Assess your answer

Foundation: explain the lost-response example and draw the state transition pending → leased → succeeded, retry-wait or expired. Senior: recover from a region outage without creating two unbounded dispatchers. Staff: migrate destination secrets and schemas while old deliveries remain queued.

Score 0–2 on each: durable intake; duplicate-effect handling; bounded retry policy; tenant isolation; operational recovery. Two points require a concrete mechanism and its limitation, one means naming the concept, zero means missing it. This learning rubric is not a hiring predictor. A diagram that says “queue gives exactly once” fails the central correctness check.

Sources and next steps

References support the underlying concepts; the proposed architecture, exercises, and rubric are our own. Review durable queues and notification delivery.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.