feat(core): add HTTP/2 performance gates

This commit is contained in:
Zakaria El Orche
2026-08-13 21:29:21 +00:00
parent 6386264a1e
commit 3679eed74a
20 changed files with 862 additions and 21 deletions
+28 -6
View File
@@ -78,7 +78,7 @@ Status values: `not started` / `in progress` / `blocked` / `done`.
| 14 — h2c prior knowledge + proxy support | done | `feature/core/http2` | Independent TLS/h2c gates, pooled proxy-oriented h2 client with TLS ALPN and h2c, bidirectional h1/h2 trailer relay, shared four-direction hop-by-hop policy and certificate-backed 421 handling complete. Real grpcurl h2c interop passes. 670/670 tests green from a clean `-Pjmh` build. |
| 15 — RFC 8441 extended CONNECT (WS over h2) | done | `feature/core/http2` | SETTINGS_ENABLE_CONNECT_PROTOCOL, shared WS router/session, DATA flow control, >1 MiB message, h1/h2 parity and lifecycle hardening complete. EX-52/53 fixed; DEC-32 recorded. 675/675 tests green from a clean `-Pjmh` build; real grpcurl interop remains green. |
| 16 — Compliance test suite | done | `feature/core/http2` | h2spec 2.6.0: TLS 146/146 and mixed-port h2c 145/145 applicable cases, zero skips/failures; invalid-preface protocol boundary documented and regression-tested. Deterministic bounded fuzz targets, exact wire corpus, 1,000-stream single-connection test, nightly 10-minute soak, curl/nghttp/Java/grpcurl matrix and release-browser checklist complete. EX-5456 fixed; DEC-33/34 recorded. Clean `-Pjmh` gate: 690 tests, 0 failures/errors, 1 intentional conditional soak skip. |
| 17 — Benchmarks, allocation gates, tuning | not started | — | — |
| 17 — Benchmarks, allocation gates, tuning | done | `feature/core/http2` | Forked JMH allocation and true sampled-p99 gates wired into CI; h1/h2/frame/HPACK/body/multiplexing/writer coverage complete. Reconstructed Phase-0 h1 baseline: 1,024.602 ns now vs 976.195 ns then with overlapping 99.9% CIs, and 0.007 vs 224.007 B/op. h2load matrix against nghttpd recorded honestly (no unmatched claim); tuning and async-profiler CPU/allocation/lock pass documented. EX-57/58 and DEC-35/36 recorded. Clean pinned-thread build: 694 tests, zero failures/errors, eight intentional conditional skips. |
| 18 — Documentation | not started | — | — |
---
@@ -855,6 +855,25 @@ connection `PROTOCOL_ERROR`. **Fix**: preface verification now distinguishes mat
and invalid input; invalid input sends GOAWAY. The exact 24 bytes are in the regression corpus.
**Phase**: 16.
### EX-57 — Wire-closed streams occupied the live concurrency table until their final write callback
Found by the Phase 17 h2load matrix at the advertised 64-stream concurrency. A response stream
could be closed in protocol state while its final immutable write batch was still owned by the
serialized writer. Keeping that object in the live table made a legal replacement stream receive
`REFUSED_STREAM`; recycling it immediately would instead corrupt the pending write callback.
**Fix**: detach a closed stream from live lookup before submitting its final batch, retain bounded
object ownership until the callback, and cap live plus detached objects at twice the advertised
live capacity. The regression test fills a one-entry table, detaches its final generation, admits
the next stream, and proves both objects return to the pool. **Phase**: 17.
### EX-58 — The upstream HTTP/2 client left Nagle enabled on synchronous exchanges
Found while building the Phase 17 end-to-end benchmark. The proxy-oriented client sends small
request and control frames and then synchronously waits for the response; with Nagle enabled this
interacted with delayed ACKs and added roughly 40 ms to a local exchange. **Fix**: configure
`TCP_NODELAY` on both cleartext and TLS sockets before protocol exchange. A socket-option
regression test covers the shared configuration method. **Phase**: 17.
---
# PART III — The phases
@@ -3122,11 +3141,14 @@ decisions and the rejected ones. Every claim in the project's marketing about pe
be traceable to a number in this file.
### DoD
- [ ] Allocation gates green in CI and wired to fail the build.
- [ ] Latency baselines recorded.
- [ ] h1 performance is not worse than the pre-Phase-1 baseline.
- [ ] No carrier pinning anywhere.
- [ ] `flash/docs/http2/PERFORMANCE.md` complete with the comparison against a reference server.
- [x] Allocation gates green in CI and wired to fail the build.
- [x] Latency baselines recorded in `BASELINES.md`; CI reads JMH's actual `p0.99` secondary
result, not iteration-mean statistics.
- [x] h1 performance is not statistically worse than the reconstructed pre-Phase-1 baseline:
the 99.9% confidence intervals overlap, while allocation falls from 224.007 to 0.007 B/op.
- [x] No carrier pinning anywhere — full 694-test clean run with
`-Djdk.tracePinnedThreads=full`, zero pinning events.
- [x] `flash/docs/http2/PERFORMANCE.md` complete with the comparison against nghttpd.
---