perf(runtime): remove TCP response registry mutex#11008
Open
jthomson04 wants to merge 2 commits into
Open
Conversation
Contributor
WalkthroughReplaces StreamRegistries Refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/runtime/src/pipeline/network/tcp/server.rs`:
- Around line 461-466: The cleanup hook in the tcp server currently spawns an
async task just to call the synchronous cancel_registered_subject, which can
delay deregistration and fail without a Tokio runtime. Update the cleanup path
in the with_cleanup closure to invoke
cleanup_registries.cancel_registered_subject(StreamType::Request,
&cleanup_subject) directly, and make the same inline change in the other cleanup
hook that uses the same pattern. Keep the logic synchronous and preserve the
existing cleanup_subject and cleanup_registries handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 452f2116-6e9f-44b3-a517-3d613efd6e23
📒 Files selected for processing (1)
lib/runtime/src/pipeline/network/tcp/server.rs
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.
Summary
TcpStreamServerresponse/request stream registry mutex with shardedDashMapregistries.Why
I've been looking into benchmarks of how the Dynamo frontend scales with higher concurrencies. A customer raised an issue where the frontend was hitting a bottleneck despite frontend cpu being underutilized. To show this, they ran a benchmark with the frontend and one worker, measuring performance. They then scaled up to 8 workers with the same per-worker concurrency, and found that Dynamo was only able to acheive 4x the performance improvement compared to the expected 8x.
Benchmark Evidence
Focused 8 worker, concurrency 1024, ISL 256, OSL 32, 50k prompts, frontend CPU request/limit 32, KV routing enabled:
Observed throughput improvement: +6.7% output tok/s.
CPU was not saturated in either run. Frontend average CPU stayed around 20% of its 32-core limit, and workers stayed well below their CPU allocation.
Registry timing also collapsed in the diagnostic run:
pre_sendresponse_stream_registerValidation
cargo fmtcargo test -p dynamo-runtime tcp_stream_server -- --nocapturecargo test -p dynamo-runtime pipeline::network::tcp::server::tests -- --nocapturecargo check -p dynamo-runtime