diff options
| author | tv <tv@krebsco.de> | 2026-11-05 04:36:58 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-05 04:36:58 +0100 |
| commit | c7226385f3765b2a72b7b4d95129fb20fec58d5c (patch) | |
| tree | 6d6f6e1b6c58c16789551068f2daa8e19524abe2 /src/simtest/bench.rs | |
| parent | 39980623f81e9e75f142f55a35794bf7a53aa38b (diff) | |
push changes experiment
Diffstat (limited to 'src/simtest/bench.rs')
| -rw-r--r-- | src/simtest/bench.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs index 19603d2..91b0aa7 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -40,6 +40,13 @@ const ONLY: &str = "BENCH_SCENARIO"; /// cores, but they share them, so delays (and what depends on timing) may come out /// higher than alone; message counts barely. const PARALLEL: &str = "BENCH_PARALLEL"; +/// If `1`, changes along writers' trees go as they are, not in Automerge sync messages +/// (`AppState::push_changes`): `BENCH_PUSH=1`, to measure against. +const PUSH: &str = "BENCH_PUSH"; + +fn pushing() -> bool { + std::env::var(PUSH).is_ok_and(|value| value == "1") +} const SETTLE: Duration = Duration::from_secs(180); /// How the swarm is made. @@ -432,10 +439,12 @@ async fn run(seed: u64, scenario: &'static Scenario) -> String { let ids: Vec<String> = (0..scenario.nodes).map(|i| format!("n{i:03}")).collect(); (scenario.net)(&sim, &ids); let reply_timeout = scenario.reply_timeout.unwrap_or(SYNC_REPLY_TIMEOUT); + let push = pushing(); let timing = move |config: &mut crate::node::NodeConfig| { config.timing = Timing::new(KEEPALIVE, reply_timeout, DELIVERY_LIMIT); // As in production (`--neighbours`). config.neighbours_k = 12; + config.push_changes = push; }; let mut nodes = vec![sim.start_on_with(&ids[0], (scenario.on)(0), &[], Start::Genesis, timing)]; // Those there from the start; the others join during the workloads. @@ -486,10 +495,15 @@ async fn run(seed: u64, scenario: &'static Scenario) -> String { let _ = writeln!( out, - "\n{} ({} writes at {} a second each)", + "\n{} ({} writes at {} a second each{})", scenario.name, WRITES, - 1000 / WRITE_EVERY.as_millis() + 1000 / WRITE_EVERY.as_millis(), + if pushing() { + "; changes pushed along trees" + } else { + "" + } ); let mut joined = initial; for (w, (workload, writer)) in [ |
