Load testing
A load run sends a mix of messages at a rate you choose, for as long as you choose, and passes or fails on thresholds you set: latency, errors, and whether the system kept up. It’s a scenario file like any other, so it lives in your repository and runs from CI.
1. Describe the load
Section titled “1. Describe the load”Add a load: block to a scenario:
name: Authorization loadtarget: {simulated_host: Issuer, timeout_ms: 2000}load: rate: 200 # requests a second, once ramped up ramp_up_seconds: 10 # from zero to the rate, linearly duration_seconds: 60 # at the rate, after the ramp connections: 4 mix: - {sample: auth, amount: 2500, weight: 8} - {sample: financial, amount: 4000, weight: 1} - {step: Contactless purchase, weight: 1} thresholds: p95_ms: 50 p99_ms: 200 error_rate: 0.005 achieved_rate: 0.98steps: - name: Contactless purchase send: {sample: auth, amount: 1200, fields: {22: "071"}}- The mix is weighted: each entry is a sample message with the same options as a step’s
send(amount, card number, fields), one of the scenario’s steps by name, or a capture’s requests, so the load looks like your real traffic (the captures walkthrough, section 8). Chip cards work in a load too:chip: true(orcontactlessfor the contactless entry mode, orwrong) on an entry sends verified chip data from a simulated issuer’s chip card, as in the stateful issuer walkthrough. PINs, repeats until answered and MACs are for steps: a load’s samples don’t take them. - Each message gets its own STAN, and amounts vary from half to one and a half times the one given, so the target sees traffic like the real thing. Steps’
expectblocks aren’t checked under load; the thresholds judge the run. - The target is the scenario’s: a simulated host, or your own system by address, with TLS if it needs it. Load goes nowhere else.
examples/scenarios/authorization-load.yaml is this example.
Spikes and steps. Instead of a rate, a ramp and a duration, a load can be a list of stages. Each holds its rate for its seconds, or with ramp: true climbs to it from the stage before:
load: stages: - {rate: 200, seconds: 60} # a minute at 200 a second - {rate: 2000, seconds: 10, ramp: true} # climb to 2,000 over ten seconds - {rate: 2000, seconds: 30} # the spike - {rate: 200, seconds: 60} # back down: does it recover? connections: 8 mix: [{sample: auth}]A step profile goes up by the same amount at even intervals, to find where answers start to slow:
load: step: {from: 100, by: 100, every_seconds: 60, to: 1000}A load lasts at most seven days, in up to 1,000 stages, so a soak can run over a weekend. The rate cap applies to its highest stage. A long run’s page keeps its latest hour second by second, and shows older seconds a minute at a time; percentiles and the verdict come out the same either way.
The highest rate it sustains. Instead of fixed rates, a load can search for the highest rate the target sustains within the thresholds:
load: search: {from: 500, to: 20000, trial_seconds: 30, resolution: 0.05} workers: auto connections: 16 mix: [{sample: auth}] thresholds: {p99_ms: 50, error_rate: 0.001, achieved_rate: 0.98}It runs trials, each a ramp from zero over ramp_seconds (5) and then the rate held for trial_seconds:
- Doubling. The rate doubles from
fromuntil a trial misses a threshold or reachesto. - Narrowing. The search then halves the gap between the highest rate that passed and the lowest that failed, until the gap is within
resolution(5%) of the rate that passed. - When the load generators fall behind, that trial says nothing about the target. With
workers: autoit’s tried again with one more load generator, if one is free. Otherwise the search ends, saying the load generators were the limit. - The verdict. The run passes with the highest rate sustained, and fails if even
fromwasn’t. The figures shown are that trial’s. The page lists every trial, and the CI client prints the rate found.
A search needs at least one threshold, and stops like any run. examples/scenarios/rate-search.yaml is this example.
More than one load generator. One load generator sends about 2,000 requests a second. For more, a run can be shared:
load: rate: 8000 duration_seconds: 300 connections: 16 workers: 4 # or auto mix: [{sample: auth}]Each of the four sends a quarter of every stage’s rate on a quarter of the connections, and all of them start together, so they ramp and step together. The run’s page shows the seconds added up, and the verdict is decided from all of them. With workers: auto, the run gets enough load generators for its highest rate at what one sends (2,000 a second unless the operator sets LOAD_WORKER_RATE), up to as many as are running.
A shared run waits in the queue until that many load generators are free, and can be stopped while it waits. It fails if it asks for more than are running, and if one of its load generators stops partway: a run never passes on part of its load. Operators start more load generators with docker compose up -d --scale loadgen=4.
Terminal fleets. A load sends from one terminal unless you give it a fleet: how many terminals there are, and what each one’s fields are, with {{terminal}} for its number:
load: rate: 300 ramp_up_seconds: 5 duration_seconds: 60 connections: 8 fleet: terminals: 200 fields: {41: "FC{{terminal}}", 42: "FORECOURT 12"} # 41 is FC001 to FC200; 42 the same for every terminal mix: [{sample: auth, amount: 4500}]- Requests take the terminals in turn, so every terminal of this fleet sends once or twice a second, and each terminal keeps to one connection, as a real one keeps to its link: routing by terminal and per-terminal counting at the target see what a site’s would. A run shared by several load generators gives each its own block of the fleet.
{{terminal}}is the terminal’s number, from 1, zero padded to the width of the highest (001 to 200 here).digitssets the width andfirstthe first number. Withoutfields, each terminal’s id (41) is T and its number.pathsset sub-elements per terminal the same way, in a dialect that lays them out (a batch number in 48.4, say).- A mix entry’s own fields and paths win over the fleet’s, and a capture’s requests keep the terminals they were recorded from.
- The run’s page says how many terminals it sent from. A fleet needs at least as many terminals as connections.
examples/scenarios/terminal-fleet-load.yaml is this example.
2. Run it and watch
Section titled “2. Run it and watch”Start it from the scenario’s page, or from CI with iso8583sim-run.py. Load runs need the editor role, and an install caps the rate a run may ask for (5,000 a second unless the operator sets MAX_LOAD_RATE).
While it runs, its page charts each second: requests answered against the target rate, and p50 and p95 latency. Stop ends it early; a stopped run fails, and keeps what it measured.
The message log during a load run. A simulated host logs at most 1,000 exchanges a second. That’s the data policy’s message log rate, which an admin can change in Settings. The run’s own figures count every request. The log keeps the first exchanges of each second and, after them, one entry per second saying how many more there were, the answers they got, and how many failed. To keep every message of a run, record it through a capture point.
3. Read the verdict
Section titled “3. Read the verdict”When it ends, the thresholds are judged over the steady seconds. The ramp-up is left out, so a system may warm up. Answers and timeouts that arrive after the last second count toward latency and errors, since they belong to the last requests, but not toward throughput:
| Threshold | Passes when |
|---|---|
p50_ms, p95_ms, p99_ms |
that percentile of round trips is at most this |
error_rate |
timeouts, errors and failed connections, as a share of requests sent, are at most this |
achieved_rate |
answers, as a share of what the steady seconds asked for (each second against its own rate), are at least this |
Percentiles come from histograms accurate to 1%. In CI, each threshold is a test case in the JUnit report, so a missed one fails the build:
FAIL Authorization load (authorization-load.yaml, run 812) sent 12,600, answered 12,598 (199.9/s of 200/s), p95 61.0 ms, p99 140.2 ms compared with run 811: achieved 199.9/s (was 199.92/s, no change), p95 61.0 ms (was 48.8 ms, +25.0%), p99 140.2 ms (was 131.0 ms, +7.0%) XX p95 <= 50 p95 was 61.0 (limit 50) ok p99 <= 200 ok error rate <= 0.005 ok achieved rate >= 0.98When the generator falls behind. The load generator also reports, each second, how many of its sends went out more than 10 ms after they were due, and how busy it was. If more than 1% of a second’s sends were late in more than 5% of the seconds, the run says so: its figures then describe the generator as much as the target. A shared run says so when any of its load generators fell behind. Ask for a lower rate, share the run among more load generators, or give them more CPU.
4. Compare with earlier runs
Section titled “4. Compare with earlier runs”A finished load run is compared with the run of the same scenario before it: throughput, p50, p95 and p99, and the error rate, each with its change. A change of 5% or more is marked better or worse; smaller ones are run-to-run noise. Pick any earlier run to compare with instead. Runs of a saved scenario compare with that scenario’s runs; scenarios sent from CI compare by name. The CI client prints the comparison under each load run’s summary, as above.
In the public demo, load runs need the editor role, which visitors don’t have; the demo runs its own “Authorization load” after every reset, to look at.
Limits for now
Section titled “Limits for now”A search runs its trials one after another, so it may take a while: at most 15 trials for the example. Its page shows each trial as it’s judged, and the one under way.