moonpool ~
GitHub →
$ techniques

Swarm testing

Each seed draws its own set of faults. A lot of a few finds more than a little of each.

The problem

With every fault family on in every run, each family gets a small share of the run. Some bugs need one fault many times, with no other fault in the way: a long partition and no reboot, or a disk that fails again and again. When each run has a little of everything, these runs never come.

The technique

With ChaosMode::Swarm, each seed switches each fault family off with a probability of one half. The families that stay on get all of the run. Over many seeds, each family is on in about half of the runs, and alone or with few others in some of them. The seed decides the set, so the set replays with the seed.

The simulator records the families of each seed in a chaos_families event. It is read-only: it draws nothing and does not change the run.

The live run

Eight seeds of the same register, with network faults, storage faults and reboots in swarm mode. Each row is one seed: a dot for each family that is on. Columns 1 to 9 are the network families, columns a to l the storage families. Hover a column for its name. Select a row to open its run in the player.

the fault families of each seed

  1. 1 clog
  2. 2 partition
  3. 3 bit_flip
  4. 4 random_close
  5. 5 connect_failure
  6. 6 clock_drift
  7. 7 buggified_delay
  8. 8 pair_latency
  9. 9 black_hole
  10. a corruption
  11. b eio
  12. c misdirect
  13. d phantom_write
  14. e sync_failure
  15. f short_transfer
  16. g dir_entry_loss
  17. h crash_damage
  18. i degradation
  19. j disk_failure
  20. k dropped_mutation_discard
  21. l writeback_error

The code

One mode for each surface. The site's engine picks Swarm or Random for the network and the storage:

let mode = if swarm {
    ChaosMode::Swarm
} else {
    ChaosMode::Random
};
if chaos.network {
    out.push(Chaos::Network(mode));
}
if chaos.storage {
    out.push(Chaos::Storage(mode));
}

A test can also remove families for each seed, with network_fault_mask andstorage_fault_mask: a mask applies after the swarm draw and draws nothing.

In the Guide

All the techniques