aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
diff options
context:
space:
mode:
Diffstat (limited to 'src/simtest')
-rw-r--r--src/simtest/bench.rs34
1 files changed, 34 insertions, 0 deletions
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.