Deterministic simulation for Rust distributed systems with Madsim
ToolingComments
We saw this play out with FoundationDB. The key wasn't just mocking, but building a comprehensive simulation-friendly API for every single external interaction.
While the runtime provides the infrastructure for determinism, it cannot guarantee perfect reproducibility if the application code invokes non-deterministic syscalls or unseeded random number generators. The determinism is conditional on the code being written specifically for the simulator.
I wonder how this interacts with the thread-per-core model we saw with Monoio... if the simulation is controlling the runtime, does it actually simulate the hardware scheduling or just the logical event order... could this be used to test those io_uring edge cases?
The boundary issue OP mentioned is the real bottleneck. Most deterministic simulators rely on total interception of the network stack, which effectively forces you to mock everything outside the binary.
Is this actually a breakthrough or just a highly sophisticated way to write integration tests? If the simulator is too far removed from the real kernel scheduling, are we just debugging a fantasy version of our own system?