pub struct Attrition {
pub max_dead: usize,
pub prob_graceful: f64,
pub prob_crash: f64,
pub prob_wipe: f64,
pub recovery_delay_ms: Option<Range<usize>>,
pub grace_period_ms: Option<Range<usize>>,
}Expand description
Built-in attrition configuration for automatic process reboots.
Provides a default chaos mechanism that randomly kills and restarts server
processes during the chaos phase. For custom fault injection strategies,
implement FaultInjector instead.
§Probabilities
The prob_* fields are weights that get normalized internally. They don’t
need to sum to 1.0, but all must be non-negative.
§Example
Attrition {
max_dead: 1,
prob_graceful: 0.3,
prob_crash: 0.5,
prob_wipe: 0.2,
recovery_delay_ms: None,
grace_period_ms: None,
}Fields§
§max_dead: usizeMaximum number of simultaneously dead processes.
The attrition injector will not kill a process if the number of currently dead (not yet restarted) processes is already at this limit.
prob_graceful: f64Weight for RebootKind::Graceful reboots.
prob_crash: f64Weight for RebootKind::Crash reboots.
prob_wipe: f64Weight for RebootKind::CrashAndWipe reboots.
recovery_delay_ms: Option<Range<usize>>Recovery delay range in milliseconds.
After a process is killed (crash or force-kill after grace), it restarts after a seeded random delay drawn from this range.
Defaults to 1000..10000 (1-10 seconds) if not set.
grace_period_ms: Option<Range<usize>>Grace period range in milliseconds (for graceful reboots).
After the per-process shutdown token is cancelled, the process has this long to clean up before being force-killed. The actual duration is a seeded random value from this range.
Defaults to 2000..5000 (2-5 seconds) if not set.