Repository navigation
perf(server): tune HTTP/2 settings, single-chunk response framing, and disk decode - #231
Merged
Merged
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThis PR speeds up single-entry responses and disk reads.
No new actionable issues or repository-rule violations were found. Checks were source-based; no tests were run during this review. Reviews (2) · Last reviewed commit: "perf(server): bypass stream machinery fo..." · Reviewed by Greptile |
…op max_send_buf_size
Merged
shikhar
pushed a commit
that referenced
this pull request
Nov 23, 2026
## 🤖 New release * `cachey`: 0.13.6 -> 0.13.7 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.13.7](0.13.6...0.13.7) - 2026-11-23 ### Other - *(deps)* upgrade dependencies and fix RUSTSEC-2026-0592 ([#233](#233)) - *(server)* tune HTTP/2 settings, single-chunk response framing, and disk decode ([#231](#231)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Server-side HTTP/2, single-entry hot-path, and cache-decode performance improvements:
HTTP/2 server concurrency (
src/bin/server.rs):max_concurrent_streamsfrom hyper's default200to1024so clients sharing a single HTTP/2 connection per instance can multiplex bursts beyond 200 in-flight fetches.SETTINGS_MAX_FRAME_SIZEis receiver-advertised in HTTP/2, so cachey's outboundDATAframe size is governed by the client.Single-entry fast path & trailer-free single-chunk framing (
src/service/mod.rs,src/service/routes.rs):FetchPlan(SingleEntryFetch/MultiPageFetch) shared by bothroutes::fetchandCacheyService::getso single-entry fetches bypassBox::pin(stream),Arc<EntryGetExecutor>,buffered(2)(FuturesOrdered), andStreamBody/async_streamentirely, returningaxum::body::Body::from(chunk.data).END_STREAMdirectly on the finalDATAframe instead of emitting an extra emptyHEADERS(END_STREAM)trailers frame (clients now observe no trailing header block on single-chunk and early-EOF responses instead of an empty one).MultiPageFetch::streamand emit per-pagec0-statustrailers.Zero-fill elimination in
CacheValue::decode(src/cache.rs):BytesMut::zeroed(data_len)+reader.read_exactwithVec::with_capacity(data_len)+reader.take(data_len as u64).read_to_end(&mut buf)+ exact-lengthUnexpectedEofcheck +Bytes::from(buf), avoiding zero-filling up to 16 MiB before immediately overwriting it on disk reads.Benchmark results (release loopback,
axum-server 0.9.2/rustls 0.23.46/hyper 1.12.0/h2 0.4.20/reqwest 0.13.5)c=8, 4000 reqs, TLS+H2):StreamBody+ empty trailers:38.3–39.7k RPS(p50198–206 µs, p99317–329 µs)Body::from(Bytes):44.5–45.3k RPS(+14–16% RPS, p50174–177 µs, p99276–291 µs)CacheValue::decode(16 MiB page):BytesMut::zeroed + read_exact:872 µsVec::with_capacity + take().read_to_end:557 µs(1.57× faster, zero reallocation)Verification
cargo +nightly fmtcargo clippy --locked --workspace --all-features --all-targets -- -D warnings --allow deprecatedcargo nextest run --locked --all-features --lib --bins+--tests(222 passed, including HTTP/2 single-chunk, multi-page, and early-EOF framing tests andUnexpectedEofdecode test)cargo deny checkcurrently flags pre-existingRUSTSEC-2026-0592onurl 2.5.8inCargo.lock(untouched by this PR).