Skip to content
CareChaosGitHub ↗

Scenario library

Seven preconfigured experiments. Each states a hypothesis and carries assertions that really can fail. Run them against the resilient implementation or the deliberately weak reference to see the difference.

Healthy baseline

No faults. Establishes the reference behavior and latency of the pipeline.

Hypothesis: With no faults injected, every reading is processed, every expected alert is delivered promptly, and all services stay healthy.

Initial conditions: 200 synthetic readings at 1 per second from 4 fictional devices; all services healthy; default capacities.

Fault configuration:
  • None

Expected behavior: 100% processing and delivery, p95 alert latency under 2 virtual seconds, no queue buildup.

Assertions:
  • All readings are processed
  • All expected alerts are delivered
  • All services remain healthy throughout
  • p95 end-to-end alert latency ≤ 2s
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Processing success rate · Delivery rate · p95 alert latency · Peak queue depth

Delayed readings

Adds 15 virtual seconds of latency on the Readings Processor input for one minute.

Hypothesis: If the processor is slowed by 15s, readings still arrive intact but late; the service reports degraded, stale data is flagged, and latency returns to normal after the fault ends.

Initial conditions: Baseline traffic. Latency fault of +15s on the Readings Processor from t=40s to t=100s. Stale threshold 10s.

Fault configuration:
  • Latency fault: +15s on processor for 60s.

Expected behavior: Affected readings take at least 15s end to end, are flagged stale, nothing is lost, and later readings return to baseline latency.

Assertions:
  • The delayed service is reported as degraded during the fault
  • Affected readings show at least the injected delay
  • Delayed data is flagged stale
  • Latency returns to baseline after the fault ends
  • All expected alerts are eventually delivered
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Median and p95 latency · Stale-flagged events · Delivery rate

Duplicate events

Replays 30% of incoming readings with the same event ID.

Hypothesis: If devices or networks redeliver readings, an idempotent pipeline processes each event ID once and never shows a clinician the same alert twice.

Initial conditions: Baseline traffic. Duplicate delivery on the Ingestion API at 30% intensity from t=30s to t=150s.

Fault configuration:
  • Duplicate delivery fault: 30% of events into ingestion replayed with the same event ID.

Expected behavior: Every injected duplicate is rejected, accepted and rejected events are counted separately, no duplicate alerts reach the dashboard.

Assertions:
  • All injected duplicates are rejected
  • No duplicate alerts are delivered
  • Each unique reading is processed exactly once
  • All expected alerts are delivered
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Duplicate rejection rate · Duplicates accepted · Duplicate alerts delivered

Alert service outage

The Delivery Service is unavailable for 60 virtual seconds, then recovers automatically.

Hypothesis: If the alert service becomes unavailable, events remain queued and are processed after recovery, within the configured limits.

Initial conditions: Baseline traffic. Outage of the Delivery Service from t=60s to t=120s. Retry: 8 attempts, exponential backoff 1–8s, dead-letter redrive on recovery.

Fault configuration:
  • Outage fault: delivery unavailable for 60s.

Expected behavior: Delivery stops during the outage, the backlog is visible, nothing is lost, and queued alerts are delivered after recovery.

Assertions:
  • The service is marked unavailable during the fault
  • No alert is reported as delivered while the service is unavailable
  • Queued events are visible during the outage
  • Queued events are delivered after recovery
  • Recovery completes within 60s
  • Queues are fully drained by the end of the window
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Queue depth · Recovery time · Delivery rate · Data loss by reason

Missing data / packet loss

Drops 10% of readings before they reach the Ingestion API.

Hypothesis: If the link drops readings, the pipeline can detect the gaps via sequence numbers or end-of-run reconciliation, and loss is attributed to the injected fault, not to an unknown cause.

Initial conditions: Baseline traffic. Packet loss of 10% into the Ingestion API from t=10s to t=190s. Each device numbers its readings sequentially.

Fault configuration:
  • Packet loss fault: 10% of events into ingestion dropped.

Expected behavior: Observed loss is close to 10%, every missing reading is identified, and no other loss occurs.

Assertions:
  • Observed loss matches the configured rate (±8 points)
  • Every dropped reading is identified as a gap
  • All readings that were not intentionally dropped are processed
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Observed loss rate · Gaps detected · Data loss by reason · Processing success rate (excluding intentional loss)

Recovery backlog

The Readings Processor is down for 60s at 2 readings/s, then drains its backlog at a limited capacity.

Hypothesis: If the processor is down, a backlog builds; after recovery it drains at the configured capacity without losing events, and the recovery time is bounded.

Initial conditions: 400 readings at 2/s. Outage of the Readings Processor from t=40s to t=100s. Drain capacity 3 events/s while recovering.

Fault configuration:
  • Outage fault: processor unavailable for 60s.

Expected behavior: Queue depth rises to roughly 120, drains after recovery, recovery time reflects (backlog ÷ net drain rate), and nothing is lost.

Assertions:
  • The processor is marked unavailable during the fault
  • A backlog of at least 50 events builds
  • Backlogged readings are processed after recovery
  • Backlog drains within 180s of restoration
  • Queues are fully drained by the end of the window
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Queue depth over time · Drain time / recovery time · Peak backlog · Data loss

Out-of-order events

Holds 25% of readings for 8s so that newer readings overtake them.

Hypothesis: If readings arrive out of order, event time is preserved and an older reading never overwrites a newer measurement.

Initial conditions: Baseline traffic. Out-of-order delivery into the Ingestion API at 25% intensity with an 8s hold, from t=20s to t=140s.

Fault configuration:
  • Out-of-order fault: 25% of events into ingestion held 8s so newer readings overtake them.

Expected behavior: Reordering is observed, event timestamps are unchanged, and no stale overwrite of newer data occurs.

Assertions:
  • Reordering is observed in processing order
  • Event time is preserved and distinct from processing time
  • No newer measurement is overwritten by an older one
  • All readings are processed
  • All expected alerts are delivered
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Reordered readings · Late arrivals · Stale overwrites

Device clock skew

30% of readings carry a timestamp 30s ahead of when they were taken.

Hypothesis: If a device clock runs ahead, the pipeline notices readings stamped in the future, keeps them (the values still matter), replaces the timestamp with the arrival time and flags it, so no future-dated alert reaches clinicians unflagged.

Initial conditions: Baseline traffic. Clock skew into the Ingestion API at 30% intensity with a 30s skew, from t=20s to t=140s. Tolerance for a device clock ahead of arrival time: 5s.

Fault configuration:
  • Clock-skew fault: 30% of readings into ingestion are stamped 30s ahead of when they were taken.

Expected behavior: Skewed readings are detected on arrival and corrected, nothing is dropped, and every expected alert is still delivered.

Assertions:
  • The fault shifts reading timestamps ahead of the true time
  • No future-dated reading reaches clinicians without being flagged and corrected
  • All readings are processed
  • All expected alerts are delivered
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Delivery rate · Stale flagged · Event-to-delivery latency

Network partition

The link into the Readings Processor is cut for 60s. Every service still reports healthy.

Hypothesis: If the link into a service is cut while the service keeps running, the pipeline notices that deliveries keep failing although the target reports healthy, holds the events instead of dropping them, and completes them after the link heals.

Initial conditions: Baseline traffic. Network partition on the link into the Readings Processor from t=40s to t=100s. Both services stay healthy throughout; only the link between them is cut.

Fault configuration:
  • Network partition: the link into processor is cut for 60s. processor keeps running and reports healthy, but nothing can reach it.

Expected behavior: A suspected partition is reported, events are held or dead-lettered rather than silently dropped, and everything generated during the cut is processed after the link heals.

Assertions:
  • The cut link is reported as a suspected partition although both services report healthy
  • Events that cannot cross the cut link are held or dead-lettered, not dropped
  • Events generated during the partition complete after it heals
  • All readings are processed
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Events held · Dead-lettered events · Processing success rate

Game day: a bad afternoon

Five failures in one run: a slow processor, duplicate deliveries, a delivery outage, packet loss and a processor outage.

Hypothesis: A resilient pipeline absorbs a sequence of unrelated failures: nothing is lost except what the experiment drops on purpose, every duplicate is rejected, and each outage drains after recovery.

Initial conditions: 300 readings at 1 per second over a 420 s window. Faults start and stop on a schedule, some overlapping (see the timeline).

Fault configuration:
  • Latency fault: +15s on processor for 50s.
  • Duplicate delivery fault: 30% of events into ingestion replayed with the same event ID.
  • Outage fault: delivery unavailable for 50s.
  • Packet loss fault: 10% of events into ingestion dropped.
  • Outage fault: processor unavailable for 30s.
Latency · Readings Processor
30s–80s
Duplicates · Ingestion API
60s–210s
Outage · Delivery Service
100s–150s
Packet loss · Ingestion API
160s–240s
Outage · Readings Processor
220s–250s

Expected behavior: Each fault shows its own impact and recovery. The only losses are the injected packet loss. All queues are empty at the end.

Assertions:
  • All readings not intentionally dropped are processed
  • All injected duplicates are rejected
  • No duplicate alerts are delivered
  • The delayed service is reported as degraded during the fault
  • Affected readings show at least the injected delay
  • Delayed data is flagged stale
  • Latency returns to baseline after the fault ends
  • The service is marked unavailable during the fault
  • The service does no work while unavailable
  • Queued events are visible during the outage
  • Events generated during the outage complete after recovery
  • Recovery completes within 120s
  • Queues are fully drained by the end of the window
  • Observed loss matches the configured rate (±8 points)
  • Every dropped reading is identified as a gap
  • No event is silently lost: every reading is processed or has a recorded loss reason
  • No readings or alerts are lost for reasons other than the injected fault

Relevant metrics: Recovery time per outage · Duplicate rejection rate · Observed loss rate · Peak queue depth