aboutsummaryrefslogtreecommitdiffstats
path: root/src/simtest
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-05 04:36:58 +0100
committertv <tv@krebsco.de>2026-11-05 04:36:58 +0100
commitc7226385f3765b2a72b7b4d95129fb20fec58d5c (patch)
tree6d6f6e1b6c58c16789551068f2daa8e19524abe2 /src/simtest
parent39980623f81e9e75f142f55a35794bf7a53aa38b (diff)
push changes experiment
Diffstat (limited to 'src/simtest')
-rw-r--r--src/simtest/bench.rs18
-rw-r--r--src/simtest/mod.rs1
2 files changed, 17 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 [
diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs
index e9d8c15..26e85c7 100644
--- a/src/simtest/mod.rs
+++ b/src/simtest/mod.rs
@@ -187,6 +187,7 @@ impl Sim {
earlier_actors: Vec::new(),
timing: Timing::new(KEEPALIVE, SYNC_REPLY_TIMEOUT, DELIVERY_LIMIT),
neighbours_k: 8,
+ push_changes: false,
alias: Some(id.to_owned()),
dashboard_url: None,
electorate_window: Duration::from_secs(30 * 24 * 3600),