aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/development.md3
-rw-r--r--src/simtest/bench.rs27
2 files changed, 21 insertions, 9 deletions
diff --git a/docs/development.md b/docs/development.md
index 781a837..2b12268 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -28,7 +28,8 @@ with `BENCH_SCENARIO`, part of its name: `BENCH_SCENARIO=NAT`; all at once with
somewhat higher; and in `bench_bridge`, large values from a writer on a fast transport
through a bridge to a node on a slow one: what that node gets as sync messages and as
blobs against what was written, 200 values unless `BENCH_BRIDGE_WRITES` says
-otherwise), and
+otherwise, over a slow link of 50 MiB/s and 500 ms round trips unless
+`BENCH_BRIDGE_SLOW_RATE` (MiB/s) and `BENCH_BRIDGE_SLOW_RTT` (ms) say otherwise), and
the same estimated on the member list's graph alone for up to 2000 members, with some
links down, as now and along the writer's tree (`swarm/topology/tests.rs`,
`bench_writer_trees`). One of
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs
index 426507b..ab1809d 100644
--- a/src/simtest/bench.rs
+++ b/src/simtest/bench.rs
@@ -664,9 +664,13 @@ const BRIDGE_WRITES: usize = 200;
const BRIDGE_VALUE: usize = 256 * 1024;
/// A hundred a second.
const BRIDGE_EVERY: Duration = Duration::from_millis(10);
+/// The slow transport, unless `BENCH_BRIDGE_SLOW_RATE` (MiB/s) and
+/// `BENCH_BRIDGE_SLOW_RTT` (ms) say otherwise.
+const BRIDGE_SLOW_RATE_MIB: u64 = 50;
+const BRIDGE_SLOW_RTT_MS: u64 = 500;
/// A writer on a fast transport (5 ms round trips, 1 GiB/s), a bridge on it and a slow
-/// one (500 ms round trips, 50 MiB/s), and a node on the slow one alone: a writes 256
+/// one (500 ms round trips, 50 MiB/s, by default), and a node on the slow one alone: a writes 256
/// KiB values at 100 a second (25 MiB/s, a quarter of the fast link, half of the slow
/// one), b passes them on to z. What z gets, as sync messages and as blobs (deltas),
/// against what was written, and how late.
@@ -674,19 +678,26 @@ const BRIDGE_EVERY: Duration = Duration::from_millis(10);
#[ignore = "a benchmark: cargo benchmarks"]
async fn bench_bridge() {
println!();
- let writes = std::env::var("BENCH_BRIDGE_WRITES")
- .ok()
- .and_then(|writes| writes.parse().ok())
- .unwrap_or(BRIDGE_WRITES);
+ let env = |name: &str, default| {
+ std::env::var(name)
+ .ok()
+ .and_then(|value| value.parse().ok())
+ .unwrap_or(default)
+ };
+ let writes = env("BENCH_BRIDGE_WRITES", BRIDGE_WRITES as u64) as usize;
+ let slow_rate = env("BENCH_BRIDGE_SLOW_RATE", BRIDGE_SLOW_RATE_MIB);
+ let slow_rtt = env("BENCH_BRIDGE_SLOW_RTT", BRIDGE_SLOW_RTT_MS);
let sim = Sim::with_identity(71);
sim.net.set_default_link(LinkParams {
delay: (Duration::from_micros(2_000), Duration::from_micros(3_000)),
rate: Some(1 << 30),
..LinkParams::default()
});
+ // Half the round trip each way, give or take a twentieth.
+ let half = Duration::from_millis(slow_rtt / 2);
sim.net_for("sim2").set_default_link(LinkParams {
- delay: (Duration::from_millis(240), Duration::from_millis(260)),
- rate: Some(50 << 20),
+ delay: (half - half / 20, half + half / 20),
+ rate: Some(slow_rate << 20),
..LinkParams::default()
});
let timing = |config: &mut crate::node::NodeConfig| {
@@ -752,7 +763,7 @@ async fn bench_bridge() {
.map_or("beyond the last bucket".to_owned(), |ms| format!("{ms} ms"))
};
println!(
- "\nfast writer, bridge, slow node ({writes} values of {} KiB, {} a second)\n \
+ "\nfast writer, bridge, slow node ({writes} values of {} KiB, {} a second; slow link {slow_rate} MiB/s, {slow_rtt} ms round trips)\n \
written: {:.1} MiB in {:.1} s; z converged {} ms after the last write\n \
b sent (to a and z): SYNC {} messages, {:.1} MiB; BLOB {} messages, {:.1} MiB\n \
z received: SYNC {} messages, {:.1} MiB; BLOB {} messages, {:.1} MiB: {:.2} times what was written\n \