diff options
| -rw-r--r-- | docs/development.md | 5 | ||||
| -rw-r--r-- | src/simtest/bench.rs | 39 |
2 files changed, 25 insertions, 19 deletions
diff --git a/docs/development.md b/docs/development.md index 2b12268..1771539 100644 --- a/docs/development.md +++ b/docs/development.md @@ -28,8 +28,9 @@ 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, 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 +otherwise, over a fast link of 1 GiB/s and 5 ms round trips and a slow one of 50 +MiB/s and 500 ms unless `BENCH_BRIDGE_FAST_RATE`, `BENCH_BRIDGE_SLOW_RATE` (MiB/s), +`BENCH_BRIDGE_FAST_RTT` 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 ab1809d..d5ca624 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -664,13 +664,16 @@ 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. +/// The fast transport and the slow one, unless `BENCH_BRIDGE_FAST_RATE`, +/// `BENCH_BRIDGE_SLOW_RATE` (MiB/s) and `BENCH_BRIDGE_FAST_RTT`, `BENCH_BRIDGE_SLOW_RTT` +/// (ms) say otherwise. +const BRIDGE_FAST_RATE_MIB: u64 = 1024; +const BRIDGE_FAST_RTT_MS: u64 = 5; 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, by default), and a node on the slow one alone: a writes 256 +/// A writer on a fast transport (5 ms round trips, 1 GiB/s, by default), 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 /// 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. @@ -685,21 +688,23 @@ async fn bench_bridge() { .unwrap_or(default) }; let writes = env("BENCH_BRIDGE_WRITES", BRIDGE_WRITES as u64) as usize; + let fast_rate = env("BENCH_BRIDGE_FAST_RATE", BRIDGE_FAST_RATE_MIB); + let fast_rtt = env("BENCH_BRIDGE_FAST_RTT", BRIDGE_FAST_RTT_MS); 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: (half - half / 20, half + half / 20), - rate: Some(slow_rate << 20), - ..LinkParams::default() - }); + // Half the round trip each way, give or take a fifth. + let link = |rate_mib: u64, rtt_ms: u64| { + let half = Duration::from_micros(rtt_ms * 500); + LinkParams { + delay: (half - half / 5, half + half / 5), + rate: Some(rate_mib << 20), + ..LinkParams::default() + } + }; + sim.net.set_default_link(link(fast_rate, fast_rtt)); + sim.net_for("sim2") + .set_default_link(link(slow_rate, slow_rtt)); let timing = |config: &mut crate::node::NodeConfig| { config.timing = Timing::new(KEEPALIVE, SYNC_REPLY_TIMEOUT, DELIVERY_LIMIT); config.neighbours_k = 12; @@ -763,7 +768,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; slow link {slow_rate} MiB/s, {slow_rtt} ms round trips)\n \ + "\nfast writer, bridge, slow node ({writes} values of {} KiB, {} a second; fast link {fast_rate} MiB/s, {fast_rtt} ms round trips; 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 \ |
