feat(bench): URUS_SCHED_THREADS knob in plain_serve

E1 (herd-vs-stranding discrimination) sweeps smarm scheduler count at
fixed low concurrency. Strict parse — a malformed value panics instead
of silently reverting to default, and the effective value is logged to
stderr so every bench cell's server.log records it (same per-cell
verification discipline as mode-verify).
This commit is contained in:
Claude
2026-07-23 14:59:45 +00:00
parent 14be21db15
commit 72064c7a79
+15 -2
View File
@@ -8,7 +8,11 @@
//! externally (wrk).
//!
//! Env:
//! URUS_PORT listen port (default 8080; binds 0.0.0.0)
//! URUS_PORT listen port (default 8080; binds 0.0.0.0)
//! URUS_SCHED_THREADS smarm scheduler OS threads (default: smarm's own
//! default). Malformed values panic rather than
//! silently falling back — a benchmark knob that
//! quietly reverts to default poisons the cell.
//!
//! cargo run --release --example plain_serve
@@ -30,6 +34,15 @@ fn main() {
.and_then(|v| v.parse().ok())
.unwrap_or(8080);
let addr: SocketAddr = format!("0.0.0.0:{port}").parse().expect("addr");
let sched_threads: Option<usize> = std::env::var("URUS_SCHED_THREADS").ok().map(|v| {
v.parse()
.unwrap_or_else(|_| panic!("URUS_SCHED_THREADS not a usize: {v:?}"))
});
// Audit line: lands in each bench cell's server.log so the effective
// scheduler count is recorded per cell, same discipline as mode-verify.
eprintln!("plain_serve: scheduler_threads={sched_threads:?}");
let mut cfg = Config::new(addr);
cfg.scheduler_threads = sched_threads;
let pipe = Pipeline::new().plug(Router::new().get("/json/:id", json_id));
serve_with(Config::new(addr), pipe).expect("serve");
serve_with(cfg, pipe).expect("serve");
}