Repository navigation
Conversation
Quest-Claim: acb9ab45fc80b599
The prototypes live on proto/quic-borrow-free. On a pinned core a Mutex costs 1.1-3.5% over context passing, a RefCell 0.2-1.0%, and the driver-owned channel 5-29%. The driver-level prototypes and the fanout sweep remain, pending whether they are still worth building. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The maintainer chose to stop at the mechanism report (2026-11-01). Delete the quest; the report stays in the PR body, and adoption is planned separately. The lock-contention quest now cites the measured costs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 303d25daed61ef545a46e12e2444155521e811dc.
No actionable bugs found in the quest-only changes. Removing the completed quest and pointing the lock-contention plan at the mechanism report is a proportionate, simpler outcome than landing channel machinery without a demonstrated workload win. The remaining plan correctly keeps the contended baseline and adoption decision separate; there is no runtime, public API, or wire change here.
Verification: inspected all three changed documents, the report, surrounding plan, and review history (no prior published review). Static review only: I did not run tests, reproduce the measurements, or validate the non-landing prototype branch. The report's single-core and noisy threaded measurements do not establish production contention performance.
(Written by OpenAI)
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — This run reviewed the quest-only finish of quest/m2/perf/quic-borrow-free.md: the quest file is deleted, its index bullet is removed, and quic-lock-contention.md now cites the measured costs instead of the deleted quest.
- Quest deleted —
quest/m2/perf/quic-borrow-free.mdis removed; the mechanism report lives in the PR body per the recorded maintainer decision (2026-11-01). - Index bullet removed —
quest/m2/perf/README.mddrops the borrow-free entry, the standard quest-completion convention. - Pointer rewritten —
quest/m2/perf/quic-lock-contention.mdreplaces the borrow-free link with a citation to PR #7531's numbers (Mutex +1.1–3.5% over context passing; driver-owned channel ~4.5k instructions/stream plus ~320/write) and drops it from## Related.
I verified the cited figures against the report's tables; they agree. A git grep -i for borrow.free leaves only two valid citations, both PR URLs (quic-lock-contention.md:51, kio-waiter-costs.md:13), so no stale quest-path references remain.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Finishes quest/m2/perf/quic-borrow-free.md and deletes it. This mechanism report is the quest's deliverable and its evidence; the perf epic README has no findings section, so the report lives here.
Summary
This is the borrow-free report. I built three prototypes, all on real moq-quic connections, and measured them against today's lock with deterministic instruction counts. The maintainer chose to stop at this mechanism report (see Decisions), so the driver-level prototypes in moq-tokio and moq-uring and the fanout-bench sweep are not built, and adoption is planned separately.
proto/quic-borrow-free(c368f72). Per the Plan it does not land. It containsrs/moq-quic/benches/share.rs, plus three moq-quic credit queries that only the channel driver uses:Streams::write_limit,Streams::initial_send_credit, andsend::Stream::writable.Method
share.rsruns a relay, the server, that opensstreamsnew uni streams per round on each ofconnssubscriber connections. It makeswriteswrites of 1200 bytes to each stream and then finishes it. Each subscriber leases each stream to its end, releases the lease, and stops the stream. A round ends once every stream has been read and the path has settled. The harness uses the benches' plaintext crypto, an unlimited controller, and virtual time. Every shape makes the same moq-quic calls, using thepoll_*forms that moq-dev/moq#7391 landed. Every task wake is the same lock-free run-queue push. The shapes differ only in how a handle reaches the connection:context&mut ConnectionrefcellRc+ IDRefCell::borrow_mut, plus a driver flagmutexArc+ IDMutex::lock, plus a driver wake per changechannelArc<cell>How the
channelshape works:Bytesto its ownkio::log::Writer. Before appending it reserves stream credit and connection credit, which the driver publishes as monotonic atomics. It then pushes its cell onto the driver's dirty stack.poll_leasewakes the cell. The driver hands theLeaseto the reader through the cell, and the reader hands it back forrelease.Measurement.
perf stat -e instructions:u, withtasksetpinning a core. The steady-state cost is the difference between two round counts, divided by the extra streams. Two full sweeps agreed within 0.6% per cell.Results: instructions per stream, single core
What the table shows:
Mutexcosts about 290 instructions per stream, plus about 100 per extra write. TheRefCellcosts 0.2–1.0%. The 1-stream rows are higher because per-round costs, mostly ACKs and timers, are spread over a single stream.kio::log: its epoch pin, flush, and collect, and its segment retire on drop;Results: threaded, wall ns per stream (median of 5, noisy host, load 12–20)
Each relay connection's streams are spread over
writersthreads. The main thread drives every connection and runs every subscriber. These numbers are indicative only: the main thread is the bottleneck, and in the channel shape it also does the moq-quic writes that the mutex shape leaves on the writer threads.The mutex shape had the lower median in 13 of 16 cases. The channel was ahead only when 2–4 writers shared a single connection, which is the most contended case.
API each implies
Context passing
Connection::send_stream(id)andrecv_stream(id)borrow the connection mutably and take an ID.Clonetokens. Every operation takes the connection (conn.write(&mut stream, buf)) from one owner task that polls its children (kio::Tasks).transport::poll's&selfsession methods and its&mut selfstream methods gain a connection context. Per-subscription tasks become children of the session task.Driver-owned channel
&selfandSend.Today's lock: no change.
Recommendation (mine; adoption is decided through
/quest-plan)Keep the lock and
RefCellon the data path, and do not build the channel design.Mutexcosts 1.1–3.5% more than context passing, and theRefCellunder 1%.transport::poll, and giving up per-connection parallelism on tokio. A prototype of that is effectively the adoption itself.Decisions
/quest-plan(maintainer, 2026-11-01), run by the parent session. This PR plans nothing; the adoption follow-up is below.Choices made without asking
kio::log, as the Plan names.group_size = 0shape. The 16-write rows cover longer groups.proto/quic-borrow-free, outside thequest/namespace.Overlaps
poll_lease,poll_accept,poll_write). Any driver-level prototype should come after moq-quic owns its waits #7490.Suggested follow-ups
/quest-plan). Recommended goal: a recorded verdict on how moq-quic's connection is shared with its stream handles. Options: (1) keep theMutexandRefCell(recommended: they cost 1.1–3.5% and under 1% over context passing on one core); (2) context passing, starting in moq-uring where each connection already has one owner per core, after waits and the lock-contention profile; (3) the driver-owned channel (not recommended: +5–29%, worst on fanout's one-write-per-stream shape, ahead only with 2–4 writers on one connection).kio::logcosts about 1.3k instructions for a short-lived log, in epoch pin, flush, and collect plus segment retirement. Already planned: kio waiter costs cites this PR.Review
Local review skipped under the simple-review rule (moq-dev/quest#364): head 303d25d touches only quests. No online-reviewer findings were posted on the PR.
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code