Repository navigation
Share portsend bandwidth with a 64KB quantum - #33
Merged
Merged
Conversation
Network.Sender still writes the socket, but partition ordering and 64KB coalescing are now a pure queue. CI runs the stress tests that show flat_size priority and unbounded buffering under two downloads. Co-authored-by: dominic.letz <dominic.letz@berlin.de>
Map iteration order differs between OTP 28.3 and 28.5. The stress tests now assert that one partition is drained before the other, without naming the winner. Co-authored-by: dominic.letz <dominic.letz@berlin.de>
Partitions rotate once they have sent 64KB, weighted by payload bytes. A push no longer skips the queue while the writer is waiting. Tests cover interleaving and linear enqueue cost. Co-authored-by: dominic.letz <dominic.letz@berlin.de>
dominicletz
marked this pull request as ready for review
September 25, 2026 10:27
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d4bc3c4. Configure here.
| {:ok, mux, data, meta} -> | ||
| ack(meta) | ||
| GenServer.reply(from, data) | ||
| {:reply, :ok, %Sender{state | mux: mux, waiting: nil}} |
There was a problem hiding this comment.
Push double-replies while writer waits
Medium Severity
When push runs while a writer is blocked in await, the frame is enqueued with the caller as meta and popped immediately. ack replies :ok to that caller, and deliver_waiting also returns {:reply, :ok}, so the caller gets two replies and a leftover {ref, :ok} remains in its mailbox.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit d4bc3c4. Configure here.
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
Network.Muxnow shares an edge socket acrossportsendpartitions instead of always serving the lightest queue.quantum/0), then the ring rotates. Weight is payload bytes, not:erts_debug.flat_size/1.:queues, so enqueue is O(1).awaitjoins the ring. It does not jump ahead of a frame that is already queued.Network.Senderstill owns the SSL write and the ack replies.Tests
DIODE_MINIMAL_TEST=1 mix test --no-start test/network/mux_test.exsin CI.Not in this change
There is still no per-port memory cap. Fair rotation stops one download from monopolizing the socket; a stalled reader can still grow the other port's queue. The client scheduler is the paired diode_client_ex PR.