Deterministic simulation testing (DST) is a method of testing distributed systems.1 The theory is simple: “run multiple systems communicating with each other on a single thread and control all randomness in each system”.

This is the opposite of what distributed systems are: random and concurrent.

DST is in use at TigerBeetle and a few other start-ups.

Basics

DST controls randomness by assuming a single global seed for randomness in a program. The simulator will control the seed. This means that when a bad state is observed, it is reproducible, and thus debuggable.

The way DST achieves this is via dependency injection. In other words, a given system/function can be passed a dependency (filesystem/network I/O, clock, RNG) an explicit parameter. For example, this means that the function can: use the computer clock in normal execution, and a simulator clock during testing.

Footnotes

  1. “Fuzzing++” — Raahil