perf(vanilla-io_uring): serve /static via static_assets (precompression + borrowed send)#951
Open
enghitalo wants to merge 2 commits into
Open
Conversation
293a86a to
c060506
Compare
Contributor
Author
|
/benchmark -f vanilla-io_uring |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
enghitalo
added a commit
to enghitalo/vanilla
that referenced
this pull request
Jun 29, 2026
emit_into now hands a preloaded (small) asset's precomputed response to the worker to send DIRECTLY (borrowed) when the backend supports it (io_uring core.queue_buf), instead of always copying it through the per-connection write buffer. The bytes are immutable for the server's lifetime, so borrowing is safe; queue_buf returns false on any backend that can't borrow-send (epoll, TLS, non-Linux), where `out << response` stays the path — so behavior is unchanged there. This folds the io_uring static borrowed-send (the per-entry queue_buf in MDA2AV/HttpArena#951) into the one audited static path, so both backends can serve /static through static_assets: precompressed negotiation + ETag/Vary + sendfile(2) for large bodies (epoll) + queue_buf borrowed send for small bodies (io_uring). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 29, 2026
…on + borrowed send) Supersedes the per-entry queue_buf change: /static now goes through the lib's audited static_assets module (mounted at /static/ via url_prefix), which both negotiates the precompressed .br/.gz sibling per Accept-Encoding AND emits small assets via core.queue_buf borrowed send — the MDA2AV#75 mechanism, folded into the module (enghitalo/vanilla#81) so it is the ONE static path shared with vanilla-epoll. Two wins instead of one: - precompression: the static profile sends `Accept-Encoding: br;q=1`, so this ships the ~4x smaller .br body instead of the raw file (the former identity-only map ignored Accept-Encoding) — the dominant fix for this profile; - borrowed direct send: the preloaded, immutable bytes are sent by the worker directly (core.queue_buf), never copied through the per-connection write buffer. Verified DB-free on the io_uring backend: /static/app.js + Accept-Encoding: br -> Content-Encoding: br, 47,275 B; components.css.br delivered byte-exact (33,268 B). Drops the hand-rolled StaticFile / static_response / content_type. Bumps the vanilla pin to main + MDA2AV#80 (url_prefix) + MDA2AV#81 (queue_buf emit). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c060506 to
2ff607a
Compare
…V#81 merged) Both lib deps are now on vanilla main: enghitalo/vanilla#80 (static_assets url_prefix) and MDA2AV#81 (core.queue_buf borrowed send). Repin from the MDA2AV#81 branch commit to the merged main commit. No entry change; rebuilds clean (v -prod). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
/benchmark -f vanilla-io_uring |
Contributor
|
👋 |
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.
What changed since the original
The original PR did a per-entry
core.queue_bufborrowed send for the (identity-only) preloaded asset. This supersedes it:/staticnow goes through the lib's auditedstatic_assetsmodule, mounted at/static/(enghitalo/vanilla#80url_prefix), which both negotiates the precompressed.br/.gzsibling AND emits small assets viacore.queue_bufborrowed send — the #75 mechanism, folded into the module (enghitalo/vanilla#81). One audited static path, shared with vanilla-epoll (#954).Why
The
/statichandler preloaded identity only (skipping.br/.gz) and ignoredAccept-Encoding, so it shipped the uncompressed body while the profile sendsAccept-Encoding: br;q=1, gzip;q=0.8. Two wins now instead of one:.brbody (the dominant fix; vanilla-io_uring currently collapses onstatic: ~3.5K rps / 213 MB at static-6800);core.queue_buf), never copied through the per-connection write buffer (the original PR's win, kept).Drops the hand-rolled
StaticFile/static_response/content_type.Verification
Built clean (
v -prod). The io_uring +static_assets+queue_bufpath verified DB-free on the io_uring backend (the entry itself needs Postgres at boot, so this used a minimal harness on the same lib):/static/app.js+Accept-Encoding: br→Content-Encoding: br, 47,275 B (vs 204,800 identity);components.css.brdelivered byte-exact (33,268 B). For the epoll sibling the same module gives +83% rps / −52% bandwidth in a 2-core A/B (#954) — io_uring should see a larger jump since it starts from the broken-static baseline.Pin
Bumps the vanilla pin to main + #80 (url_prefix) + #81 (queue_buf emit). Depends on those two (both open against enghitalo/vanilla; #80 already merged). The Dockerfile pins the #81 branch commit so CI builds today; it lands on vanilla
mainonce #81 merges.🤖 Generated with Claude Code