Add FairQueue single-peer fast path#271
Conversation
- Bypass the ready queue and streams map while only one stream is connected. - Promote back to the fair queue path when a second stream is inserted. - Cover single-stream delivery, promotion, and disconnect callback behavior.
|
Do you have any kind of benchmark data that would confirm that this change actually makes a noticeable improvement in performance? For me it looks like a complication of logic without any clear reason |
|
Thanks, that is a fair concern. Yes, I measured this before splitting it out from the larger performance branch. The benchmark case where this showed up was the large-payload IPC receive path, especially the one-way benchmarks that avoid mixing receive cost with ROUTER echo-send cost. The benchmark shape was:
The local before/after numbers for this specific change were:
Since the workload size is fixed, the lower elapsed time corresponds to higher receive-side throughput. In throughput terms, those reductions are roughly equivalent to about The reason I tried this path is that the one-way D/R and P/P results both pointed at common receive-side cost rather than ROUTER identity or echo-send cost. With a single connected peer, the existing The intended safety boundary is:
I added tests for those cases:
That said, I agree this is a core scheduling type, so the complexity needs to justify itself. I can add these benchmark numbers to the PR description/comment. If you still think the extra logic is not worth carrying in |
Summary
This splits the FairQueue change out of #267 for a focused review.
Changes:
Validation
cargo fmt --checkcargo test --lib test_fair_queueReview note
This PR is intentionally separate from the send batching and PUB fanout changes. If the FairQueue risk is not acceptable right now, this PR can stay draft or be dropped without blocking the other split PRs.