aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-06 23:59:13 +0100
committertv <tv@krebsco.de>2026-11-06 23:59:13 +0100
commit6d61543fc41c6fa0ad04a637a816be1d37273d1d (patch)
tree09262f9eda747a32e6b05b57aac61827aa52626d
parentee78e31138f5d88279872c34c9488f15d3cbc176 (diff)
soak neighbours and settled links
-rw-r--r--src/simtest/soak.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/simtest/soak.rs b/src/simtest/soak.rs
index 2a9272a..6285e2c 100644
--- a/src/simtest/soak.rs
+++ b/src/simtest/soak.rs
@@ -117,6 +117,22 @@ const CHURN_WRITE_EVERY: Duration = Duration::from_millis(500);
const AWAY_EVERY: Duration = Duration::from_secs(20);
const AWAY_FOR: Duration = Duration::from_secs(15);
const RESTART_EVERY: Duration = Duration::from_secs(120);
+/// How many neighbours each node has (`topology::our_neighbours`), `when`.
+fn neighbour_counts(out: &mut String, nodes: &[AppState], when: &str) {
+ use std::fmt::Write;
+ let counts: Vec<usize> = nodes
+ .iter()
+ .map(|node| crate::swarm::topology::our_neighbours(node).len())
+ .collect();
+ let _ = writeln!(
+ out,
+ " neighbours {when}: {:.1} on average, {} to {}",
+ counts.iter().sum::<usize>() as f64 / counts.len().max(1) as f64,
+ counts.iter().min().copied().unwrap_or(0),
+ counts.iter().max().copied().unwrap_or(0),
+ );
+}
+
/// How long the quiet phase at the end is watched.
const CHURN_QUIET: Duration = Duration::from_secs(30);
@@ -304,6 +320,7 @@ async fn soak_with_churn() {
.map_or("more than an hour".to_owned(), |ms| format!("{ms} ms")),
);
super::bench::sent_kept(&mut out, &nodes).await;
+ neighbour_counts(&mut out, &nodes, "at the end");
// For PlumTree and HyParView: their links and views at the end (nothing otherwise).
super::bench::eager_links(&mut out, &nodes, &sim.net);
super::bench::active_views(&mut out, &nodes);
@@ -371,6 +388,18 @@ async fn soak_with_churn() {
links.unreached, links.reached
);
}
+ // Again once the swarm had the quiet phase to settle in after the remake's switch:
+ // whether what the end shows is the switch's, or stays.
+ let mut out = String::new();
+ neighbour_counts(&mut out, &nodes, "after the quiet phase");
+ let mut links = String::new();
+ super::bench::eager_links(&mut links, &nodes, &sim.net);
+ super::bench::active_views(&mut links, &nodes);
+ if !links.is_empty() {
+ out.push_str(" after the quiet phase:\n");
+ out.push_str(&links);
+ }
+ print!("{out}");
for (what, most) in [
("peers", peers),