Repository navigation
perf(endpoint): poll_transmit visits only the connections that may send - #14
Open
pylaterreur wants to merge 2 commits into
Open
pylaterreur wants to merge 2 commits into
pylaterreur wants to merge 2 commits into
Conversation
poll_transmit walked every connection from the round-robin cursor until one sent, calling update_recovery, select_control and the scheduler on each, so with one busy connection among N idle ones every packet cost about N visits (issue mp0rta#12). The endpoint now keeps a BTreeSet of ready handles and walks it from the cursor, which keeps today's order. Every endpoint call that reaches a connection makes it ready: a packet for it, a path call, connection(h) (which hands out &mut Connection), and a handle_timeout pass after one of those. A turn that sends nothing and leaves nothing for the next turn parks the connection until then, or until its wake time passes: its deadline, or a pacing release (which poll_send_at leaves out for a go-back's lone FIN), the times when the passing of time alone can give it a segment to send. A turn that installs a held mapping, trims the reinjection head, moves the repair state or changes a subflow's TCP state leaves it ready. apply_aborts looks only at the connections the application reached. The full scan stays as a test-only oracle (Endpoint::full_scan), and diff_tests runs randomized two-endpoint scenarios both ways and checks that the packets, in order, the events, poll_timeout values, reads and call results are the same. With 2000 idle MPTCP connections a bulk transfer costs 1.8 visits per packet instead of 3962 (scale_tests). The rogue-plan tests change the probe scheduler's plan from outside the connection, so they mark it themselves (set_rogue). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN
This branch has not been deployed
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.
Part of #12.
poll_transmitwalked every connection from the round-robin cursor until one sent. With one busy connection among N idle ones, each packet cost about N connection visits.The endpoint now keeps a
BTreeSetof ready handles and walks it from the cursor, which keeps today's order exactly.connection(h)(which hands out&mut Connection), and ahandle_timeoutpass after one of those.apply_aborts, which also walked every connection on eachhandle_packet, looks only at the connectionsconnection(h)handed out.The full scan stays as a test-only oracle (
Endpoint::full_scan).diff_testsruns randomized two-endpoint scenarios both ways and checks that they produce the same packets in the same order, and the same events,poll_timeoutvalues, reads and call results.handle_timeout, short buffers.cargo testruns 40 small scenarios, about 10 s in debug.DIFF_SEEDS=1..1000 cargo test --release -p mptcp-rs diff_tests -- --ignoredruns larger ones.Connections visited per packet sent, for a 300 KB transfer next to N idle MPTCP connections (
scale_tests):Instructions for a whole run (setup plus a 1 MB transfer, callgrind, calls in the driver contract's order): N=0 −0.2%, N=10 −31%, N=100 −78%, N=1000 −93%.
Testing:
cargo test, clippy, fmt, the 1.85 MSRV build, and the fuzz targets.diff_testson 40 small and 400 large scenarios.No public API change, no new dependency.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GwUvhmzgfkiZ6vo4uGyesN