feat(bench): ka/close A/B matrix — plain_serve baseline + box orchestrator
The jar's ka-vs-close throughput inversion was observed on the box but its
run configuration died with the job workspaces, so it can't be re-derived —
this commit makes the comparison a committed, controlled experiment instead
of a lost one-off.
- examples/plain_serve: the load_profile request path with zero causal
machinery (same route/handler/Config), serving until killed. The plain
half of the A/B; throughput measured externally by wrk.
- scripts/ka-close-matrix.sh: {ka,close} x {plain,causal} on fresh ports,
byte-identical wrk args per mode pair except the Connection: close
header, disjoint-core pinning for server vs wrk, per-cell curl
verification of the negotiated connection behavior, ss/env capture, and
a parsed summary with a close/ka ratio verdict. The causal cells double
as the forgiveness-fix box validation (v13 pending item, pull-forward
agreed): key on forgiven staying ~ injected x parked-actors in
close-mode churn, not process-lifetime phantoms.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//! Plain benchmark server: the `load_profile` request path with zero causal
|
||||
//! machinery — the baseline half of the ka/close A/B matrix (the
|
||||
//! throughput-inversion chase).
|
||||
//!
|
||||
//! Identical route, handler, and `Config` construction to `load_profile`;
|
||||
//! differs only in having no `smarm-causal` feature, no sweep, and no
|
||||
//! shutdown path — it serves until killed. Throughput is measured
|
||||
//! externally (wrk).
|
||||
//!
|
||||
//! Env:
|
||||
//! URUS_PORT listen port (default 8080; binds 0.0.0.0)
|
||||
//!
|
||||
//! cargo run --release --example plain_serve
|
||||
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use urus::{serve_with, Config, Conn, Next, Pipeline, Router};
|
||||
|
||||
/// Mirrors `load_profile`'s handler byte for byte: param parse + JSON render.
|
||||
fn json_id(conn: Conn, _next: Next) -> Conn {
|
||||
let id: u64 = conn.params.get("id").and_then(|s| s.parse().ok()).unwrap_or(0);
|
||||
conn.put_status(200)
|
||||
.put_header("content-type", "application/json")
|
||||
.put_body(format!("{{\"id\":{id}}}"))
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let port: u16 = std::env::var("URUS_PORT")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(8080);
|
||||
let addr: SocketAddr = format!("0.0.0.0:{port}").parse().expect("addr");
|
||||
let pipe = Pipeline::new().plug(Router::new().get("/json/:id", json_id));
|
||||
serve_with(Config::new(addr), pipe).expect("serve");
|
||||
}
|
||||
Reference in New Issue
Block a user