code wiki / (root) / nx_weblatbench.nx

nx_weblatbench.nx

buildroot/runtime/nx_weblatbench.nx

10116 B233 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind bench
docsdependenciesstructsconstsfunctions

about

nx_weblatbench.nx -- STANDING LATENCY BENCH for the WEB serve (operator standing order 2026-08-12: progress claims need a referee that is not the claimant -- until this organ existed, every /search speed number was an ad-hoc probe chosen by the seat that wanted the number to look good). Fixed 8-query set spanning every measured shape, driven through the LIVE serve over LOOPBACK (127.0.0.1:18456 /api/search?scope=web -- the exact production stack; fetch pattern composed from nx_web_relevance_bench). One pass per run, SEQUENTIAL (this bench must never itself hammer the box: envelope = 8 queries/run, beat hourly, log ~200B/run). PRE-DECLARED ACCEPT RULE (before the first run, 2026-08-12; RATCHET DOWN as rungs land, never up): GREEN iff ok=8/8 fetches (HTTP 200 + JSON marker) AND the did-you-mean tooth fires AND p50 <= 3000ms AND max <= 20000ms. WHY these numbers: in-window queries measured 0.25-2.8s on 2026-08-12 (p50 3000 = that + margin); max 20000 deliberately TOLERATES one reopen-lottery draw (measured 10.2-11.5s, debt 1786555686) so the bench reports the tail without being permanently RED -- a detector that is always RED is one everyone learns to ignore. When the incremental-refresh re-lands, ratchet max to 5000. Output: per-query ms ALWAYS printed (a gate that reports only a boolean cannot say why), last line verdict=GREEN|RED (positional anchor), exit code carries the verdict. Appends one row per run to knowledge/status/weblatbench.log (append-only; the DISTRIBUTION over beats is the instrument -- a single run is still just a sample and must never be quoted as the population). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_weblatbench.nx

imports: nx_syscalls.nxnx_connect.nx

imported by: nobody (leaf or entry point)

structs

none

consts

22const LB_MAGIC_1000000: i64 = 1000000
23const LB_MAGIC_8192: i64 = 8192
25const LB_PORT: i64 = 18456
26const LB_OUTCAP: i64 = 1048576
27const LB_NQ: i64 = 8
28const LB_P50CAP: i64 = 3000
29const LB_MAXCAP: i64 = 20000

functions

31func lb_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
32func lb_wnum(d: *u8, off: i64, v: i64) -> i64
41func lb_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o + i] = s[i]; i = i + 1 } return o + i }
42func lb_catb(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { d[o + i] = s[i]; i = i + 1 } return o + n }
43func lb_hex(v: i64) -> i64 { if v < 10 { return 48 + v } return 55 + v }
44func lb_urlenc(src: *u8, slen: i64, dst: *u8) -> i64
63func lb_contains(hay: *u8, hn: i64, ndl: *u8) -> i64
76func lb_now_us() -> i64
83func lb_wall_epoch() -> i64
89func lb_fetch(q: *u8, resp: *u8) -> i64
120func main() -> i64