aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-06 06:19:16 +0100
committertv <tv@krebsco.de>2026-11-06 06:19:16 +0100
commit028bdaae355d677571bd21764caa17acb3687e78 (patch)
tree9ca179867aec772bb1c0b4e84f6dad2d21d82533 /src
parentd9d398522a142283b537670068cc6418402d9546 (diff)
soak counts records
Diffstat (limited to 'src')
-rw-r--r--src/simtest/soak.rs31
-rw-r--r--src/swarm/working_links.rs23
2 files changed, 42 insertions, 12 deletions
diff --git a/src/simtest/soak.rs b/src/simtest/soak.rs
index eb024d3..d14ff03 100644
--- a/src/simtest/soak.rs
+++ b/src/simtest/soak.rs
@@ -265,15 +265,22 @@ async fn soak_with_churn() {
throughputs = throughputs.max(node.throughput.lock_or_recover().len());
traffic = traffic.max(node.traffic.len());
}
- let recorded = {
- let replica = nodes[0].doc.read().await;
+ let records = |node: AppState| async move {
+ let replica = node.doc.read().await;
members::members(&replica.doc)
- .iter()
- .filter(|member| {
- members::links(&replica.doc, member) != members::RecordedLinks::default()
+ .into_iter()
+ .map(|member| {
+ let links = members::links(&replica.doc, &member);
+ (member, links)
})
- .count()
+ .filter(|(_, links)| *links != members::RecordedLinks::default())
+ .collect::<Vec<_>>()
};
+ let written = |nodes: &[AppState]| -> u64 {
+ nodes.iter().map(crate::swarm::working_links::written).sum()
+ };
+ let recorded = records(nodes[0].clone()).await.len();
+ let written_during = written(&nodes);
let end_tasks = tokio::runtime::Handle::current()
.metrics()
.num_alive_tasks();
@@ -290,7 +297,8 @@ async fn soak_with_churn() {
println!(
" per node at most: {peers} peers, round trips of {rtts}, throughput of \
{throughputs}, traffic of {traffic}; {heals} heals; {recorded} members with links \
- recorded; tasks alive {warm_tasks} after the warm-up, {end_tasks} at the end"
+ recorded, {written_during} records written (by the nodes running at the end); \
+ tasks alive {warm_tasks} after the warm-up, {end_tasks} at the end"
);
// The quiet phase: what the swarm sends with nothing to pass on.
@@ -315,12 +323,19 @@ async fn soak_with_churn() {
};
println!(
" quiet, per node and minute: {:.1} SYNC, {:.1} STATUS, {:.1} STATUS_REPLY, \
- {:.1} PING/PONG",
+ {:.1} PING/PONG; {} records written",
per_node_minute(0),
per_node_minute(1),
per_node_minute(2),
per_node_minute(3),
+ written(&nodes) - written_during,
);
+ for (member, links) in records(nodes[0].clone()).await {
+ println!(
+ " recorded after the quiet phase by {member}: unreached {:?}, reached {:?}",
+ links.unreached, links.reached
+ );
+ }
for (what, most) in [
("peers", peers),
diff --git a/src/swarm/working_links.rs b/src/swarm/working_links.rs
index 6f07375..af476c4 100644
--- a/src/swarm/working_links.rs
+++ b/src/swarm/working_links.rs
@@ -46,6 +46,15 @@ pub(crate) struct Pending {
/// Checks done (`check`), for the benchmark to wait for one (`settled`).
#[cfg(test)]
checks: u64,
+ /// Records written, for the soak (`written`).
+ #[cfg(test)]
+ written: u64,
+}
+
+/// How many times we wrote our record.
+#[cfg(test)]
+pub(crate) fn written(state: &AppState) -> u64 {
+ state.working_links.lock_or_recover().written
}
/// How many checks were done, and whether none of our links differs from our record
@@ -103,10 +112,16 @@ pub(crate) async fn check(state: &AppState) {
.mutate_doc(move |doc| members::set_links(doc, &me, &next))
.await
{
- Ok(()) => info!(
- unreached,
- reached, "Links that differ from the member list's graph recorded"
- ),
+ Ok(()) => {
+ #[cfg(test)]
+ {
+ state.working_links.lock_or_recover().written += 1;
+ }
+ info!(
+ unreached,
+ reached, "Links that differ from the member list's graph recorded"
+ )
+ }
Err(error) => warn!(error = %error, "Failed to record our links"),
}
}