diff options
| author | tv <tv@krebsco.de> | 2026-11-03 07:55:30 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-03 07:55:30 +0100 |
| commit | 68e1db7f15d8e932be67c04d27dc57c3bb17b53b (patch) | |
| tree | a5c62e5777d843023ca22867f81d424091853655 | |
| parent | 781dd223ec3260757299d79250d7448bc46f9814 (diff) | |
add member away benchmark
| -rw-r--r-- | docs/development.md | 3 | ||||
| -rw-r--r-- | src/simtest/bench.rs | 34 |
2 files changed, 36 insertions, 1 deletions
diff --git a/docs/development.md b/docs/development.md index 0b424e3..db89c04 100644 --- a/docs/development.md +++ b/docs/development.md @@ -21,7 +21,8 @@ The benchmarks are ignored tests named `bench_*`: the document's (writes and syn messages, `document/bench.rs`), the remakes' replay (`remake/bench.rs`), and what passing changes on costs over the simulated network (`simtest/bench.rs`: messages and bytes per write by kind, propagation delays, for a full mesh, a writer behind NAT, two -transports and partial meshes of 50 and 100 nodes; several minutes, or one scenario +transports, partial meshes of 50 and 100 nodes, lossy links, and a member away for a +while; several minutes, or one scenario alone with `BENCH_SCENARIO`, part of its name: `BENCH_SCENARIO=NAT`; all at once with `BENCH_PARALLEL=1`, faster on many cores, though sharing them makes delays come out somewhat higher), and diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs index acf91bf..9ffb93c 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -52,6 +52,11 @@ struct Scenario { net: fn(&Sim, &[String]), /// The node that writes in the one-writer workload. writer: usize, + /// A node that goes away for the middle half of each workload (it is taken off the + /// net, as if gone without a word) and comes back, if any: 50 writes at 5 a second, + /// 10 s, not long enough to be held dormant (four keepalives, 20 s), so what a node + /// that is gone costs before the others notice. + away: Option<usize>, } fn sim_only(_: usize) -> &'static [&'static str] { @@ -101,6 +106,7 @@ const SCENARIOS: &[Scenario] = &[ on: sim_only, net: clean, writer: 1, + away: None, }, Scenario { name: "writer behind NAT (one link), 13 nodes", @@ -108,6 +114,7 @@ const SCENARIOS: &[Scenario] = &[ on: sim_only, net: writer_behind_nat, writer: 1, + away: None, }, Scenario { name: "two transports, 3 bridges, 30 nodes", @@ -115,6 +122,7 @@ const SCENARIOS: &[Scenario] = &[ on: two_transports, net: clean, writer: 5, + away: None, }, Scenario { name: "partial mesh, 50 nodes", @@ -122,6 +130,7 @@ const SCENARIOS: &[Scenario] = &[ on: sim_only, net: clean, writer: 1, + away: None, }, Scenario { name: "partial mesh, lossy and slow links, 50 nodes", @@ -129,6 +138,7 @@ const SCENARIOS: &[Scenario] = &[ on: sim_only, net: lossy, writer: 1, + away: None, }, Scenario { name: "partial mesh, 100 nodes", @@ -136,6 +146,15 @@ const SCENARIOS: &[Scenario] = &[ on: sim_only, net: clean, writer: 1, + away: None, + }, + Scenario { + name: "partial mesh, a member away for 10 s, 50 nodes", + nodes: 50, + on: sim_only, + net: clean, + writer: 1, + away: Some(3), }, ]; @@ -349,6 +368,21 @@ async fn run(seed: u64, scenario: &'static Scenario) -> String { { let start = Totals::of(&nodes); for i in 0..WRITES { + // The middle half, the node that goes away is gone (writing nothing). + if let Some(away) = scenario.away { + if i == WRITES / 4 { + sim.net.take_down(&ids[away]); + } else if i == WRITES * 3 / 4 { + sim.net.bring_up(&ids[away]); + } + } + let gone = scenario.away.is_some_and(|away| { + (WRITES / 4..WRITES * 3 / 4).contains(&i) && away == i % nodes.len() + }); + if writer.is_none() && gone { + tokio::time::sleep(WRITE_EVERY).await; + continue; + } let node = &nodes[writer.unwrap_or(i % nodes.len())]; // A path of each workload's own: writing what is there already changes // nothing, and nothing would pass. |
