Story #02 API Performance · Timeouts · Resilience

The Silent Timeout Problem

"The API always responded in 500ms. Then it didn't—and the retries created duplicate orders"

An order processing API slowed from 500ms to 8–10 seconds after a database migration. Consumer systems had 5-second timeouts and began retrying aggressively. Duplicate orders flooded fulfillment systems before anyone realized the root cause.

What happened

Apex Commerce’s order API was reliably fast in development—typically under 500ms. After a database migration, average response times under load climbed to 8–10 seconds. Functional tests still passed: they checked that responses were correct, not that they arrived within any time constraint.

Several consuming systems—a web storefront, mobile apps, and partner integrations—all had timeout settings around 5 seconds. When the API started exceeding that threshold, they timed out and retried. Because each retry looked like a fresh order request, the fulfillment system began creating duplicate orders.

The business spent months rebuilding trust after incorrect fulfillments, shipping the wrong items or charging customers twice.

Root cause

Performance was never part of the API contract. No test validated that responses arrived within an agreed time window. No consumer tested what happened when the API was slow rather than wrong. Retry behavior, assumed safe, was never tested against a slow-but-not-broken server.

The fix

The team added explicit latency SLAs to the API specification and wrote performance contract tests that failed if p95 response time exceeded thresholds. Order submission was made idempotent with stable order IDs so that retrying the same request never created a second order.

Lesson learned

Latency is part of the API contract. If you don’t test it, your consumers will discover your SLA violations in production—and their retry logic will amplify the damage.

The Silent Timeout Problem