docs: correct the observability cost, and record why three earlier numbers were wrong
The published figure was -3.9%. It was measured sequentially rather than interleaved, and the machine drifts 12% across a session as it warms, so run order was indistinguishable from effect. Two later attempts to correct it were also wrong: 0.8% had the same flaw, and -6.8% compared7bd11bfagainst HEAD, which differ by observability *and* three performance fixes pulling the other way, then reported their net as if it were one of them. Measured properly, alternating round by round between7bd11bfand523e318(the last commit before those fixes): +7.0% of the framework's own per-request work, about 0.29us, roughly 2% of a request over a real socket. Ranges do not overlap. The guide no longer quotes absolute throughput from this laptop. The reference numbers come from a two-box setup, and single-box loopback figures invite a comparison that is not valid. D7's shape survives: the cost is fixed per request, not per step, because per-step work is skipped when nothing subscribes. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
3 files changed
+23
-15
No files matched your search
@@ -149,7 +149,9 @@ Two things follow. `Date.now()` loses on both axes — slower *and* coarser —
|
||||
|
||||
At 0.25% per step the overhead sits **below the 0.3% run-to-run CV of the project's own benchmark**, so it is not measurable in the harness that would have to justify a flag. Making it opt-in would buy two code paths and a configuration surface in exchange for something nobody can observe. Always on.
|
||||
|
||||
> **Correction, after implementation.** This decision survived; its reasoning did not. Measured over a real socket the cost is **−3.9% on JSON hello and −2.1% on a three-step pipeline** — the shallower route loses *more*, which is the opposite of a per-step model. Per-step work is skipped entirely when nothing subscribes; what is left is a fixed per-request cost. "Always on" is still right, and for a better reason: there is nothing per-step left to make optional. See Task 7 in the implementation plan.
|
||||
> **Correction, after implementation.** This decision survived; its reasoning did not. The measured cost is **+7.0% of the framework's own per-request work** (~0.29 µs, ~2% over a real socket), and it is *fixed per request* rather than per step — per-step work is skipped entirely when nothing subscribes. "Always on" is still right, and for a better reason: there is nothing per-step left to make optional.
|
||||
>
|
||||
> Three earlier figures for this were published before that one and all three were wrong, each from a comparison with more than one variable moving. See Task 7 in the implementation plan for what went wrong and why interleaving is not optional here.
|
||||
|
||||
### D8 — Request logging is a `Bus` subscriber, wrapped so a failing logger cannot go silent
|
||||
|
||||
|
||||
@@ -116,14 +116,18 @@ Tasks 1–3 are the correction; 4–6 are what consumes it. Do not start 4 befor
|
||||
**Files:**
|
||||
- Modify: `BENCHMARKS.md`
|
||||
|
||||
D7 predicted ~0.25% **per step**, invisible against the harness's own 0.3% CV. Measured over a real socket, on the box `BENCHMARKS.md` was produced on, same server config both sides:
|
||||
D7 predicted ~0.25% **per step**, invisible against the harness's own 0.3% CV.
|
||||
|
||||
| Scenario | Before | After | |
|
||||
|---|---:|---:|---:|
|
||||
| JSON hello | 78,118 req/s | 75,075 req/s | −3.9% |
|
||||
| Pipeline (3 steps) | 70,671 req/s | 69,164 req/s | −2.1% |
|
||||
**Measured: +7.0% of the framework's own per-request work** — 4.074 µs → 4.361 µs, medians of five interleaved rounds, ranges not overlapping. About 0.29 µs, or ~2% of a request over a real socket.
|
||||
|
||||
**The route with fewer steps loses more**, which falsifies the model rather than only the number. The per-step cost is real but is skipped entirely when nothing subscribes (`Bus.hasListeners`); what remains is a **fixed per-request** cost — generating the request id, reading two headers, and the guard checks. A shallow route amortises that over less work, so it shows up larger.
|
||||
The prediction was wrong in **shape**, not only magnitude. Per-step work is skipped entirely when nothing subscribes (`Bus.hasListeners`), so a deep pipeline pays no more than a shallow one; what remains is a **fixed per-request** cost — generating the request id, reading two headers, and the guard checks. "Always on" survives, for a better reason than it was made with: there is nothing per-step left to make optional.
|
||||
|
||||
**Three earlier numbers for this were published and all three were wrong**, which is the more useful lesson: −3.9%, then 0.8%, then −6.8%. Each came from a comparison with more than one variable moving.
|
||||
|
||||
- The first two were sequential rather than interleaved. The same code measured at the start and end of one session differed by **12%** as the machine warmed, so run order was indistinguishable from effect — one of them even reported the wrong sign.
|
||||
- The third compared `7bd11bf` against `HEAD`, which differ by observability **and** three performance fixes pulling the other way. It reported their net as if it were one of them.
|
||||
|
||||
The number above compares `7bd11bf` against `523e318`, the last commit before those fixes, alternating round by round.
|
||||
|
||||
Two regressions were found and fixed by measuring rather than reasoning, both larger than anything the design anticipated:
|
||||
|
||||
|
||||
Reference in new issue
Block a user