From 18bc1b2e36bacae45ee3a0f485a117f3756152d7 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 05:20:00 +0100 Subject: push by default --- docs/development.md | 3 +-- src/main.rs | 1 - src/node.rs | 4 ---- src/simtest/bench.rs | 18 ++---------------- src/simtest/mod.rs | 1 - src/state/mod.rs | 4 ---- src/swarm/sync.rs | 9 ++++----- src/transport/mod.rs | 8 ++++---- 8 files changed, 11 insertions(+), 37 deletions(-) diff --git a/docs/development.md b/docs/development.md index e09abbc..519d64c 100644 --- a/docs/development.md +++ b/docs/development.md @@ -26,8 +26,7 @@ and with Mycelium's round trips, each link its own; and Tor's, with some slow ci members joining during the writes; several minutes, or one scenario alone with `BENCH_SCENARIO`, part of its name: `BENCH_SCENARIO=NAT`; all at once with `BENCH_PARALLEL=1`, faster on many cores, though sharing them makes delays come out -somewhat higher; with `BENCH_PUSH=1`, changes along writers' trees go as they are -rather than in Automerge sync messages, an experiment to measure against; and in `bench_bridge`, large values from a writer on a fast transport +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 fast link of 1 GiB/s and 5 ms round trips and a slow one of 50 diff --git a/src/main.rs b/src/main.rs index 8c52879..128e5a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,7 +219,6 @@ async fn main() -> Result<()> { timing: state::Timing::new(args.keepalive, sync_reply_timeout, delivery_limit) .with_probe_max(args.dormant_probe_max), neighbours_k: args.neighbours, - push_changes: false, alias: args.alias.clone(), dashboard_url: args.dashboard_url.clone(), electorate_window: args.electorate_window, diff --git a/src/node.rs b/src/node.rs index 155ed85..5bfce31 100644 --- a/src/node.rs +++ b/src/node.rs @@ -44,9 +44,6 @@ pub(crate) struct NodeConfig { /// limit)`. pub(crate) timing: Timing, pub(crate) neighbours_k: usize, - /// Changes along writers' trees as they are, not in sync messages - /// (`AppState::push_changes`). - pub(crate) push_changes: bool, pub(crate) alias: Option, /// `--dashboard-url`. pub(crate) dashboard_url: Option, @@ -122,7 +119,6 @@ impl Node { run_id: uuid::Uuid::new_v4().into_bytes(), handshakes: Default::default(), neighbours_k: config.neighbours_k, - push_changes: config.push_changes, alias: config.alias, dashboard_url: config.dashboard_url, electorate_window: config.electorate_window, diff --git a/src/simtest/bench.rs b/src/simtest/bench.rs index 91b0aa7..19603d2 100644 --- a/src/simtest/bench.rs +++ b/src/simtest/bench.rs @@ -40,13 +40,6 @@ 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. @@ -439,12 +432,10 @@ async fn run(seed: u64, scenario: &'static Scenario) -> String { let ids: Vec = (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. @@ -495,15 +486,10 @@ 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(), - if pushing() { - "; changes pushed along trees" - } else { - "" - } + 1000 / WRITE_EVERY.as_millis() ); let mut joined = initial; for (w, (workload, writer)) in [ diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs index 26e85c7..e9d8c15 100644 --- a/src/simtest/mod.rs +++ b/src/simtest/mod.rs @@ -187,7 +187,6 @@ 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), diff --git a/src/state/mod.rs b/src/state/mod.rs index f9479a1..e127877 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -105,10 +105,6 @@ pub(crate) struct AppState { /// Target number of neighbours (`--neighbours`); up to this many + 1 members the /// swarm is a full mesh. pub(crate) neighbours_k: usize, - /// Changes passed on along writers' trees go as they are (`SyncBody::Changes`), not - /// in Automerge sync messages: an experiment, measured against those - /// (`simtest::bench`, `BENCH_PUSH`), off otherwise. - pub(crate) push_changes: bool, /// Our alias (`--alias`), published in the member list (`swarm::members`). pub(crate) alias: Option, /// Where people reach our dashboard (`--dashboard-url`), published in the member list diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index aea6a0b..e551cb8 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -138,7 +138,6 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> { .map(|estimate| estimate.bytes_per_sec); let failed = peer_state_mutex.lock().await.failed_whole(Instant::now()); let delta_threshold = state.blobs.delta_threshold_for(rate, failed); - let push_changes = state.push_changes; let stats = Arc::clone(&state.stats); let clock = Arc::clone(&state.clock); @@ -168,10 +167,10 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> { delta_threshold, Instant::now(), ); - // Along a tree, taken as delivered: the changes as they are, if pushing - // (`AppState::push_changes`). Only those too small to deflate: larger - // ones go as a message, deflated (`compress`). - let pushed = (push_changes && level && writer.is_some() && again.is_none()) + // Along a tree, taken as delivered: the changes as they are + // (`SyncSession::push`). Only those too small to deflate: larger ones go + // as a message, deflated (`compress`). + let pushed = (level && writer.is_some() && again.is_none()) .then(|| { peer_state.sync.push( &replica.doc, diff --git a/src/transport/mod.rs b/src/transport/mod.rs index 2595257..85f69f5 100644 --- a/src/transport/mod.rs +++ b/src/transport/mod.rs @@ -744,10 +744,10 @@ pub(crate) enum SyncBody { /// An Automerge sync message, deflated (`compress`): a large one, which shrank. Deflated(#[serde(with = "crate::transport::wire::codec::sync_message")] SyncPayload), /// Changes passed on along a writer's tree as they are, with the sender's heads, - /// instead of an Automerge sync message (`AppState::push_changes`): where the sender - /// takes the message as delivered, it has everything the receiver has, and needs - /// none of the rest of one (`SyncSession::push`). No heads stand for the tips of - /// the changes, as the sender's heads mostly are. + /// instead of an Automerge sync message: where the sender takes the message as + /// delivered, the receiver rebuilds the rest of one (`SyncSession::push`, + /// `Received::pushed`). No heads stand for the tips of the changes, as the sender's + /// heads mostly are. Changes { #[serde(with = "crate::transport::wire::codec::change_hashes")] heads: Vec, -- cgit v1.3.1