Skip to content

Chaos experiments

A chaos experiment breaks a simulated issuer on a schedule while a load run goes through your switch, and judges what your switch did about it: whether it kept answering while the issuer misbehaved, and how soon it was back to normal afterwards. Experiments are part of a load scenario, so they run from CI like any other. Load runs themselves are in the load testing walkthrough.

Point the load at your switch, and name the simulated host your switch sends to:

name: Issuer outage at peak
target: {host: switch.bank.test, port: 8583, timeout_ms: 5000}
load:
stages:
- {rate: 200, seconds: 30, ramp: true}
- {rate: 200, seconds: 270}
mix: [{sample: auth, amount: 1000}]
thresholds: {p99_ms: 500, error_rate: 0.001}
experiments:
- name: Issuer silent for two minutes
kind: issuer_outage
host: Visa issuer # a simulated host on this Platform
start_second: 60 # from the start of the run
seconds: 120
during: {p99_ms: 3000} # your switch keeps answering, standing in or declining
recovery: {within_seconds: 30} # the run's thresholds hold again by then
  • host is a simulated host on this Platform. Experiments only ever break the Platform’s own hosts, never your systems. The host must exist and be running when the run starts, or the run is refused with the reason.
  • start_second and seconds place it in the run. Experiments may overlap, on one host or several, and must end before the load does.
  • during sets thresholds for the experiment’s seconds; recovery.within_seconds how soon after it the run’s own thresholds must hold again (30 by default).

Each kind has a default for during, so name, kind, host, start_second and seconds are enough.

Kind What the simulated host does Parameters (defaults)
issuer_outage answers nothing (silent), or closes every connection and refuses new ones (down) mode (silent)
latency_storm answers late, by a delay plus up to some jitter, for a share of requests delay_ms (2000), jitter_ms (0), share (1)
slow_drain answers later and later, from no delay at the start to a maximum at the end max_delay_ms (10000)
connection_flaps closes every connection at the start, then again every so often every_seconds (10)
network_loss loses a share of requests: they go unanswered share (0.1)
malformed_burst answers a share of requests with something that can’t be decoded share (0.1)
duplicate_storm answers a share of requests twice share (0.1)
reversal_storm leaves a share of authorizations and financial requests unanswered, and counts what your switch tells it about each afterwards share (0.1), reversed_within_seconds (60)
cutover sends a cutover (network management 201) with the next day’s settlement date, and answers with that date (field 15) until it ends none
clock_skew its answers and messages carry dates and times (fields 7, 12 and 13) off by an amount, ahead or behind offset_seconds (300)

By default an experiment expects your switch to answer within three seconds while it’s on, a typical switch timeout: a switch whose issuer fails should still answer, standing in or declining. A cutover and a clock_skew are routine, so they’re held to the run’s own thresholds instead.

When an issuer doesn’t answer, your switch decides in its place and owes it an account of what it decided:

  • an advice (0120 or 0220) of a stand-in approval, carrying the original’s STAN and transmission time;
  • a reversal (0400 or 0420) of a request it declined or gave up on, in case the issuer approved it after all, naming the original in field 90.

A reversal storm passes only if the issuer hears one or the other about at least 99% of the requests it left unanswered, within reversed_within_seconds. Otherwise those authorizations might hold a cardholder’s funds at the issuer, approved there but declined at the terminal.

The host sends the cutover on every connection your switch has open to it; it passes only if your switch answers it (00) on each one, while the load carries on within the run’s thresholds.

Both checks come from the host’s own count, sent when it stops counting, so the load must run at least five seconds past a cutover’s end, or past a reversal storm’s end plus reversed_within_seconds. A scenario that doesn’t is refused with the reason.

Start it like any load run. On its page, each experiment’s window is shaded on the throughput and latency charts, and so is the recovery after it once the run is judged, so the cause sits beside its effect. The Chaos experiments card says which are upcoming, on and over as the run goes.

The simulated host’s live activity names the experiment that acted on each request, so nobody takes it for a fault in the host. Stopping the run ends its experiments at once, and an experiment always ends at its time on its own, whatever happens to the rest of the Platform.

For each experiment the card shows:

  • its thresholds while it was on, with the figures;
  • how soon after it the run’s thresholds held again for ten seconds running, against recovery.within_seconds;
  • its kind’s own check, for a reversal storm or a cutover;
  • what the host counted: requests left unanswered, answered late, unreadably or twice, connections closed, reversals and advices received.

The run’s own thresholds are judged on the seconds outside its experiments and the recovery each is allowed, so a planned outage doesn’t fail the steady state. The run passes only if its steady seconds and every experiment pass. From CI, each experiment is a test case of its own, with why it failed.

5. Try the pack against the reference switch

Section titled “5. Try the pack against the reference switch”

examples/scenarios/chaos-<kind>.yaml has one scenario per kind, pointed at the reference switch, which every install runs and which routes Visa cards to the simulated host “Issuer” (Try it end to end creates it). Each takes two to three minutes:

python iso8583sim-run.py --url https://your-platform --junit chaos.xml examples/scenarios/chaos-reversal-storm.yaml

The reference switch stands in after its route’s three second timeout: it approves up to its floor limit and advises the issuer, and declines with 91 above it and reverses the request. So the examples that silence or slow the issuer allow four seconds while they’re on. Copy one, point its target at your switch and its host at the simulated issuer your switch sends to, and set during to your switch’s own timeout.

  • Experiments break simulated hosts during load runs only: not functional (step by step) scenarios, not the load side (a flood of reversals or duplicates from the acquirer), and not the network between the Platform and your systems.
  • A search for the highest sustainable rate can’t carry experiments, since each of its trials starts again.