4.9 KiB
RustProxy 0.34.0 DEV — OPT5, 1,040-byte reverse-proxy optimization
Acceptance boundary
The source package preserves 0.34.0 and all existing configurable services, logs, dashboards, cache/ACL/auth policies, streaming, TLS/H2/H3/WebSocket, failover, retry and bounded-resource behavior. OPT5 is a source-only candidate: no Rust compiler is available in the editing environment. The new code's compilation, Rust unit tests, binary throughput and full-protocol interoperability are unverified until the developer builds it. The compiled OPT4 executable is the known test input, not a benchmark of OPT5.
Compiled OPT4 input verification
Input: /mnt/data/rust-proxy(4), SHA-256
1c4c701f11b57b1293020061c8af21d5a9df0c86f03290018a90edc007667b24.
- The real HTTP regression runner completed 151 passing, 0 failing cases;
1 skipped because Python
zstandardis not installed. Protocol tests for TLS/H2/H3 are a separate acceptance gate and were not passed by this run. - Same-host ApacheBench HTTP/1.1 keep-alive, 1,040-byte body verified by exact SHA-256, cache OFF, 4 Tokio workers, 64 idle HTTP1 upstream connections, 3-second warm-and-measure samples, two repeats per variant/concurrency:
| RPS, median of 2 samples | 16 clients | 64 clients |
|---|---|---|
| OPT3 | 37,017 | 40,668 |
| OPT4 | 39,054 | 36,425 |
| nginx | 99,808 | 110,783 |
| OPT4 vs OPT3 | +5.5% | -10.4% |
| OPT4 / nginx | 39.1% | 32.9% |
There were zero HTTP failures and the response body was verified before/after measurements. Shared CPU and only two short samples are diagnostic, NOT a stable speedup or production proof. The 100k RPS and 80%-of-nginx goals remain unmet.
OPT5 changes (8 coherent hot-path optimizations)
src/proxy/request_id.rs: eliminate per-request SHA-256. Keep the existing OS-seeded/reseeded thread-local CSPRNG and 256-bit ID; XOR a monotonic sequence into the first 8 nonce bytes. Output remains uniformly random, 64 lowercase hex characters and the protectedX-Request-IDcorrelation remains. Random IDs continue to be unique with overwhelming probability.src/forwarding.rsandsrc/proxy/forward_entry.rs: only constructContext.original_urlfor a frontend with configured Tinyauth. This is the only runtime consumer of that absolute URL. Publiccontext(...)still constructs it by default. Trusted/untrusted forwarding and all validation still execute identically; IPv4/IPv6 andx-original-urlfor Tinyauth remain.src/balance/lease_runtime.rs: borrow"ok"for successful backend health observations instead of allocating aString. 5xx failures still record the exact originalstatus=NNNdetail and slow/passive health counters are kept.src/traffic.rs: receive 64 samples at a time (Tokiorecv_many) and apply them under a single dashboard-state mutex. Order within the existing bounded 2,048-sample queue is preserved; waiting is outside the mutex and producer backpressure and drop accounting are unchanged.src/traffic.rs: reuse map entries with borrowed vhost names. New keys are cloned only when a domain first appears, preserving the max 64-vhost bound.src/traffic.rs: classify status 1xx–5xx using static labels; preserve unknown extension status labels such as7xx.src/traffic.rs: replace per-sample lowercase allocation for User-Agent family detection with ASCII-insensitive byte-window comparisons, and avoid copying all TopTable maps when displaying a single vhost.src/proxy/upstream_helpers.rs: skip resolving inherited/vhost/web-service compression settings when no encoding is accepted even under the global codec ceiling (for exampleAccept-Encoding: identity). Existing compression handling is retained for every accepted codec and request method.
The caller's front-end policies remain evaluated on every request. No log, metric, access control or authentication feature was disabled or made optional.
Verification and outstanding gates
Static source, SQL migration and managed-upgrade tests are executed and their outcomes supplied in the external evidence archive. New Rust test fixtures cover request IDs, forwarding/trusted IPv6, compression, healthy/5xx backend detail, analytics batching, top classes, country-independent User-Agent matching, reset and the bounded queue.
To verify the new build on the developer's system:
./dev.sh check
CARGO_INCREMENTAL=0 ./dev.sh test
./dev.sh build
After building, repeat the actual HTTP regression, LB regression and TLS/H2/H3
transport tests and collect at least seven 30-second CPU-isolated, warmed,
interleaved OPT4/OPT5/nginx measurements with wrk, p95/p99 and CPU/RSS.
Treat the non-tested binaries, short shared-host tests and simulated Python
checks as distinct types of evidence. Measure the secondary Web Server path
separately. Do not alter the version or silently relax cache, auth or timeout
policies to reach a RPS target.