Overview
A high throughput ingestion service was designed to process incoming event data continuously. During traffic spikes, a portion of incoming data silently failed to appear downstream, despite every standard health check reporting the system as fully healthy. This mattered because silent data loss is far more dangerous than a loud failure: nothing alerts you, so the gap only surfaces when someone notices missing data days later.
The Problem
Under load, ingestion volume did not match what was arriving downstream. Infrastructure metrics were misleading. CPU and memory stayed low, liveness checks passed, and there were no elevated error rates anywhere in the standard monitoring. By every conventional signal, the system looked fine, which made this a genuinely hard problem to even confirm was happening, let alone diagnose.
Investigation
Since infrastructure level metrics ruled out the obvious causes, the investigation moved down a layer, into the async execution path itself. Profiling revealed that queued background tasks were accepted but not executing in a timely way. That pointed to something blocking the event loop rather than a resourcing problem. Tracing the execution path further found a synchronous network call sitting inside what was meant to be a fully asynchronous task, invisible to standard monitoring tooling because the call itself was not erroring, just quietly blocking.
BEFORE
Webhook -> Queue -> Async Worker
|
v
sync HTTP call (blocks event loop)
|
v
other queued tasks stall
AFTER
Webhook -> Queue -> Async Worker
|
v
non-blocking HTTP call (0.5s timeout)
|
+---------+---------+
| |
succeeds fails
| |
v v
enriched record flagged record
persisted persisted (fallback_mode)The Solution
The fix had three parts: switching the blocking call to a genuinely non blocking client, adding explicit timeouts so a slow dependency could not stall the whole worker, and wrapping the dependent call in a fallback path so that if enrichment failed, the core data still persisted with a flag rather than being dropped entirely.
The snippet below shows the enrichment call rewritten as non-blocking, with a bounded timeout and a fallback path rather than letting a slow dependency take the whole worker down with it.
enrich_metadata.pyasync def enrich_metadata(identifier: str, client) -> dict:
"""Non-blocking lookup with bounded timeout and fallback."""
try:
response = await client.get(f"/lookup/{identifier}", timeout=0.5)
response.raise_for_status()
return response.json()
except (TimeoutError, HTTPError) as err:
logger.warning(f"Enrichment failed for {identifier}: {err}")
return {"id": identifier, "enriched": False, "fallback_mode": True}Engineering Trade-offs
Degrade gracefully rather than fail closed. A missing piece of metadata is a smaller problem than a missing record entirely.
The key decision was not just making the call asynchronous, it was choosing to degrade gracefully rather than fail closed. A stricter approach would have rejected anything that could not be enriched, but that trades a smaller problem (missing metadata) for a bigger one (missing data entirely). Persisting an un enriched record with a flag kept the core pipeline reliable even when a dependency was not.
Challenges
The hardest part was not the fix, it was proving where the problem actually was. Every dashboard said the system was healthy, which meant ruling out infrastructure before even starting to look at application level code, and the failure only presented under load, not in normal testing conditions.
Outcome
- ✓ Event loop delay under load reduced from seconds to single digit milliseconds
- ✓ Payload loss during simulated traffic surges eliminated
- ✓ Pipeline throughput held up without additional infrastructure
Reflection
Looking back, this is a good example of why a green dashboard is not proof of a healthy system, and it changed how I approach diagnosing silent failures: check what each health signal actually measures before trusting that it covers the failure mode you are worried about.