Design a Crash Artifact Ingestion and Triage Pipeline
System DesignModel answerLast updated
Design a distributed system that collects, deduplicates, stores, and analyzes large binary crash files from a massive microservice fleet across regions.
Design a Crash Artifact Ingestion and Triage Pipeline
Your company runs a fleet of roughly 100,000 microservices spread across multiple geographic regions. When a service process crashes, the operating system writes a memory snapshot to disk — a file that can range anywhere from 100 MB to 10 GB. These files are essential for diagnosing production incidents, but their volume, size, and sensitivity make them difficult to manage at scale.
Design a system that handles the full lifecycle of these crash artifacts: from the moment a process dies on a production host all the way through storage, grouping, and developer-facing triage.
Functional Requirements
- Collection: Transfer crash files from production hosts to centralized storage without disrupting the host's ability to recover and restart services.
- Grouping: Cluster crashes that share the same root cause so developers see one actionable item rather than thousands of duplicate alerts.
- Analysis: Extract human-readable stack traces from binary files and identify the function or module responsible for the crash.
- Retention: Establish a data lifecycle policy that balances storage cost against the need to revisit historical crashes.
Non-Functional Requirements
- Host safety: The collection process must not consume enough CPU, memory, or disk to destabilize the host it runs on.
- Burst tolerance: During a bad deployment, thousands of hosts may crash within minutes. The system must absorb this without falling over or ingesting redundant data at full scale.
- Security: These files contain raw process memory, which may include credentials, tokens, or personal data. Treat them accordingly.
What to cover
Describe a high-level architecture in prose or structured text (no actual diagram tool needed). Include:
- How the agent on each host behaves before and during an upload
- The API surface for the ingestion service
- How you tier storage for different artifact sizes
- Your deduplication and grouping strategy
- How the system stays stable during a thundering-herd burst
- How you prioritize which crashes to analyze first
- Your retention and security approach
Hints
Hint 1
The biggest scaling lever is deciding what not to upload. Once you have a fingerprint from the crashing host, the server already knows whether it has seen this crash before — use that to gate whether a full dump is worth transferring at all.
Hint 2
Separate the control plane (small metadata messages) from the data plane (multi-gigabyte binary transfers). The ingestion API should issue upload credentials and then get out of the way; it should never proxy the binary bytes itself.
Hint 3
Think in layers for the thundering-herd problem: client-side sampling before the upload even starts, server-side token buckets for backpressure, and priority queues so analysis workers drain the most important work first when they are behind.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Approach
This is a storage-heavy distributed systems problem with a safety constraint: the collection process runs on the same host as production traffic, so it must be a well-behaved tenant. The design has four major concerns — host agent, ingestion API, storage tiering, and the analysis + triage pipeline — and they interact most critically around the thundering-herd scenario.
1. Size the Problem First
State your assumptions before drawing any boxes.
- 100k services, assume roughly 1M container instances across 3–5 regions.
- Baseline: ~10k crashes per day at an average of 1 GB each = ~10 TB/day raw, ~3–4 PB/year if everything were retained indefinitely.
- Burst scenario: a bad deployment causes 20k hosts to crash within 5 minutes. Naively, that is 20 TB arriving in minutes. That is not a data transfer problem — it is an admission problem.
- Key insight to state early: most crashes in a burst are identical. You do not need 20,000 copies of the same stack trace. The system should upload metadata and a fingerprint first, transfer the full binary only when it adds new information.
- Freshness target: stack trace and crash group available within 5 minutes for a new signature. Full binary analysis can be best-effort.
2. Host Agent
The agent runs as a sidecar or daemon, hooked via the OS crash handler (e.g., core_pattern on Linux or systemd-coredump). Its responsibilities, in order:
- Spool locally with a hard disk quota. If the quota is exhausted, write a minidump (registers, thread stacks, module list — typically 1–50 MB) and discard the rest. The host's disk must never fill up due to crashes.
- Unwind the crashing thread into raw addresses plus the GNU build-id of each loaded module. Compute a preliminary fingerprint from these before touching the network.
- Run within strict resource limits: CPU nice/cgroup, I/O throttle, and an upload bandwidth cap (e.g., 50 Mbps). Upload asynchronously so the orchestrator can restart the crashed service immediately.
- Pre-process before uploading: zstd compress (crash files typically compress 5–10x), scrub obvious PII patterns (environment variable blocks, heap regions matching credential patterns), encrypt with a KMS-derived key.
- Contact the ingestion API with just the metadata and fingerprint (kilobytes). The server decides whether to request a minidump, a full dump, or nothing. If the answer is "skip," the agent deletes the local spool and moves on.
- Resume on reboot: persist upload state so a restarted host can continue a partial multipart upload rather than starting over.
3. Ingestion API
The API is stateless, sits behind a load balancer, and enforces per-service and per-region token buckets.
POST /v1/crashes
Body: { service, host, region, build_id, version, signal,
timestamp, fingerprint, raw_frames[], dump_size, minidump_size }
Response 200: { crash_id, decision: SKIP|MINIDUMP|FULL, priority,
upload: { presigned_multipart_urls[], part_size, expires_at } }
Response 429: { retry_after_ms } // shed load, agent holds in spool
POST /v1/crashes/{crash_id}/complete
Body: { parts: [{ n, etag, sha256 }] }
GET /v1/groups/{group_id} // group summary, counts, affected versions
GET /v1/crashes/{crash_id}/artifact // audited short-lived download URL
Key design choices:
- Requests are idempotent on
(host, timestamp, pid)so retries are safe. - The server issues presigned multipart upload URLs directly to object storage. Parts are 64–128 MB, so a 10 GB dump can resume per-part after a network hiccup without restarting.
- The ingestion server never proxies binary bytes — it only handles the metadata handshake. This is the most important structural decision for keeping the control plane cheap and horizontally scalable.
4. Storage Tiering
| Artifact | Typical size | Store |
|---|---|---|
| Crash event, frames, group assignment | KB | DynamoDB (partition key on group_id) + OpenSearch for free-text queries |
| Minidump | 1–50 MB | S3 Standard, always uploaded when admitted |
| Full binary | 100 MB–10 GB | S3 multipart; only when decision = FULL; regional bucket for data residency |
| Debug symbols | Per build-id | Symbol server backed by S3 + local cache on analysis workers |
CI uploads stripped debug symbols (DWARF / .pdb) at build time keyed by build-id. Production binaries stay stripped. This keeps dumps smaller and means the symbol server is the only place where addresses become readable function names.
Retention policy:
- Full dumps: 30 days default, extended to 90 days for P0 crashes with open tickets, deleted immediately for SKIP decisions.
- Minidumps: 90 days.
- Crash metadata and stack traces: 1 year.
- Lifecycle rules in S3 move objects to Glacier-Instant after 14 days, then expire on schedule.
5. Deduplication and Grouping
A crash signature is a hash of: (binary name, signal, top 5–10 normalized symbolized frames of the crashing thread). Normalization strips memory addresses, template arguments, and noise frames like abort, raise, allocator internals, and signal trampolines.
Two fingerprints are computed:
- A client-side fingerprint using raw addresses + build-id — fast, computed on the host before symbolization, used for the admission decision.
- A server-side symbolized signature computed after analysis — this is the source of truth for grouping.
For partially unknown frames (missing symbols for a build-id), fall back to edit-distance comparison against existing groups and merge above a similarity threshold. Expose a UI for engineers to manually split or merge groups; feed those corrections back as rules to improve future grouping.
Each group tracks: first seen, last seen, occurrence count, affected versions and regions, owning team (from a service-to-team registry), and a regression flag that fires when a signature reappears after a prior fix.
6. Thundering Herd Defense
Three layers, applied in order:
Layer 1 — Admission sampling (biggest lever). Per signature, accept the first K=5 full dumps, the next 100 as minidumps only, then metadata-only thereafter (counts still increment). A 20k-host storm of the same crash becomes a few gigabytes instead of 20 TB. Signature counters live in Redis with a short TTL window.
Layer 2 — Backpressure. Token buckets per service and per region at the ingestion API. Return 429 with retry_after_ms plus random jitter. Agents hold the dump in their local spool and retry later; they do not drop the event.
Layer 3 — Priority queues for analysis. Assign each admitted crash a priority and enqueue it accordingly. Analysis workers drain higher-priority queues first; P3 items are TTL-expired under sustained load.
- P0: new signature, or a regression of a previously resolved group.
- P1: tier-1 or customer-facing service; canary or freshly deployed version; rapidly growing group (spike detector).
- P2: first exemplar of a known-but-open group.
- P3: additional samples of an already-ticketed, stable group.
Auto-scale analysis workers on queue depth. Analysis is CPU and memory intensive (symbolization + heap parsing), so spot/preemptible instances are appropriate here.
7. Analysis Pipeline
- Fetch the minidump; look up debug symbols by build-id from the symbol server.
- Symbolize all threads; compute the server-side signature.
- Assign to an existing group or create a new one.
- Attribute a responsible module/function using the top in-app frame (skip library frames), cross-referenced with code ownership data.
- Correlate with deploy events: crashes starting within N minutes of a deployment to the same version are tagged as likely regressions and escalated.
- Emit a ticket, alert, or — for sudden P0 spikes — an automated rollback signal.
- For P0 or P1 crashes where the minidump is insufficient, trigger a full-dump fetch for deep heap and variable inspection in an isolated sandbox with no network access.
Common Mistakes
- Proxying binary data through the ingestion service. This turns a metadata API into a bandwidth bottleneck and makes horizontal scaling ineffective.
- Uploading first, deciding later. Without an admission gate at the fingerprint step, a thundering herd floods storage before any deduplication can happen.
- Ignoring host safety. An agent that consumes unbounded disk or CPU during a crash storm causes a secondary outage on a host that is trying to recover.
- Symbolizing on the host. Sending debug symbols to production bloats binaries and increases attack surface. Always symbolize server-side.
- Flat retention. Storing all dump sizes for the same duration wastes significant money; tiered retention by artifact size and ticket status is essential at petabyte scale.