Repository navigation
feat(proto): Implement noq_proto::SendStream::set_affinity - #836
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/noq/pr/836/docs/noq/ Last updated: 2026-10-23T10:30:29Z |
flub
left a comment
There was a problem hiding this comment.
Only reviewed streams/mod.rs for now.
5ffc349 to
24a19ff
Compare
| } | ||
|
|
||
| if was_pending { | ||
| self.pending.remove(id); |
There was a problem hiding this comment.
I don't understand how this is now a possibility that there is something to remove now? Was this a bug before?
There was a problem hiding this comment.
Well, this was already possible before this PR, but it just didn't matter much. We'd go through pending stream items in write_stream_frames later and if there's not actually any data, it's just cleaned up there eventually.
Now we have multiple separate queues, and making sure that when a stream completes, making sure that the pending for it is cleaned up seems like a good idea, given we might not actually look into the queue the stream is in.
…to own n0-computer#835 baseline Preserve fork-specific congestion check, datagram scheduling, alloc/core paths, and existing timer APIs. Include tests for Any, Sticky and Block. Experimental only; no production integration.
87dc061 to
93ef714
Compare
`status_allows_data`
93ef714 to
6941c42
Compare
This allows removing the `old: ` parameters for `remove` and `set_affinity`
struct to paths.rs
* upstream/main: (24 commits) refactor(proto): call the std-only float math through crate-root helpers (n0-computer#848) refactor(proto): Avoid PathId allocation when building PATH_ACKS (n0-computer#901) chore: Release chore(deps): fix unused crates warnings of rust 1.100 (n0-computer#899) chore: Update issue template checkboxes (n0-computer#897) chore: humantime is unmaintained (n0-computer#900) chore(ci): fix workflows for test binaries locations (n0-computer#896) fix(perf): don't enable qlog feature in perf binary (n0-computer#850) fix(proto): track the key update boundary per path (n0-computer#869) tests: additional stream affinity tests (n0-computer#890) feat: allow streams to set an affinity for a path, simple version (n0-computer#881) fix(udp): handle receive errors before truncation flags in recv_single (n0-computer#884) chore: Upgrade async-executor and allow warnings in patchbay build (n0-computer#888) chore: Use shared minimal-crates worksflow (n0-computer#862) tests: Increase local slow-tests timeout (n0-computer#860) fix(proto): keep unread data when compacting an unordered stream (n0-computer#867) fix(proto): coalesce contiguous chunks during defragment (n0-computer#866) deps: Bump tokio for RUSTSEC-2026-0386 (n0-computer#868) feat(proto): Implement `noq_proto::SendStream::set_affinity` (n0-computer#836) fix(ci): bump deps for illumos (n0-computer#856) ...
Description
Implements setting a stream's affinity to being sent on paths. See the doc comment on
SendStream::set_affinityfor more information.This is implemented via keeping multiple
PendingStreamsQueues instead of just one: One queue for each possible affinity, exceptStreamAffinity::Block, which doesn't need a queue.On sending in each path, we first check the
anyqueue, and then compare it with pending streams that are pinned to our path.Between these we compare which one is supposed to go first and use that.
When a stream changes affinity, we need to potentially move it between queues.
If a stream goes from blocked to another affinity, we don't restore its recency, instead, we give it a new one. This is as if the data the stream had queued were submitted just when switching. This is to avoid a situation in which someone suddenly unblocks a lot of small streams after a long time of being blocked and these streams suddenly jumping the queue and starving out other streams.
API Changes
noq_proto::StreamAffinitynoq_proto::SendStream::set_affinityNotes & open questions
PendingQueueMutas an abstraction to ensure we don't accidentally leave emptyPendingStreamsQueues around for sticky paths that don't exist anymore.Change checklist
cargo makepasses locally.