From 4c9def8434ac690f5baa77fce273e7803e2bae17 Mon Sep 17 00:00:00 2001 From: dmitrivasilyev Date: Thu, 30 Apr 2026 16:16:13 +0300 Subject: [PATCH 1/2] experiment(runtime): enable tokio eager driver handoff A worker holding the I/O / time driver while polling a long task can stall socket readiness on other workers. Tokio 1.52 added an opt-in eager handoff on the multi-threaded runtime that wakes a previously parked worker before polling and lets it own the driver. We turn it on under tokio_unstable to see whether p99/p999 latency improves under heavy concurrency. Pure experiment branched off feature/3.7.0-rust-tokio-edition. The decision to keep, tune, or revert depends on the Ubicloud benchmark vs. the 3.7.0 baseline. --- .cargo/config.toml | 2 ++ src/app/server.rs | 1 + 2 files changed, 3 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..bff29e6e --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["--cfg", "tokio_unstable"] diff --git a/src/app/server.rs b/src/app/server.rs index 039de921..4e54f27a 100644 --- a/src/app/server.rs +++ b/src/app/server.rs @@ -92,6 +92,7 @@ pub fn run_server(args: Args, config: Config) -> Result<(), Box Date: Fri, 1 May 2026 08:13:22 +0300 Subject: [PATCH 2/2] fix(packaging): pass tokio_unstable cfg through RPM and Launchpad builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both pkg/rpm/pg-doorman.spec and debian/rules regenerate .cargo/config.toml to point at vendored sources before cargo build, which silently overwrites the rustflags entry committed for this experiment. As a result COPR and Launchpad builds failed to find Builder::enable_eager_driver_handoff. Re-deliver the cfg via RUSTFLAGS in both build scripts so the unstable API is available regardless of how the project's .cargo/config.toml is rewritten. Local cargo, Dockerfile and Ubicloud bench are unaffected — they pick up the shipped .cargo/config.toml as-is. --- debian/rules | 5 +++++ pkg/rpm/pg-doorman.spec | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/debian/rules b/debian/rules index e3d84d2c..40418b9a 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,11 @@ export DH_VERBOSE = 1 export JEMALLOC_SYS_WITH_MALLOC_CONF = dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto +# Required by tokio::runtime::Builder::enable_eager_driver_handoff (unstable API). +# The .cargo/config.toml in the source tree is overwritten below in override_dh_auto_build +# to point at vendored sources, so we re-deliver the cfg via RUSTFLAGS here. +export RUSTFLAGS = --cfg tokio_unstable + # Rust installation directory (local install, no network access on Launchpad) RUST_INSTALL_DIR = $(CURDIR)/rust-local export PATH := $(RUST_INSTALL_DIR)/bin:$(PATH) diff --git a/pkg/rpm/pg-doorman.spec b/pkg/rpm/pg-doorman.spec index 0defd36a..7199a2d8 100644 --- a/pkg/rpm/pg-doorman.spec +++ b/pkg/rpm/pg-doorman.spec @@ -62,6 +62,11 @@ EOF # Set jemalloc configuration export JEMALLOC_SYS_WITH_MALLOC_CONF="dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto" +# Required by tokio::runtime::Builder::enable_eager_driver_handoff (unstable API). +# The .cargo/config.toml shipped in the source tree is overwritten above to point +# at vendored sources, so we re-deliver the cfg via RUSTFLAGS here. +export RUSTFLAGS="--cfg tokio_unstable" + # Build release binaries cargo build --release