Repository navigation
perf(trtllm): isolate sidecar request shutdown waiters - #16082
Merged
Merged
Conversation
Give each generation request a child of the engine shutdown token so concurrent streams stop contending on the shared token's waiter mutex on every streamed message, matching the vLLM and SGLang sidecars. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Contributor
Contributor
✅ Dynamo PR CI passed — run 38019186166 (attempt 1) on
|
tmonty12
approved these changes
Oct 12, 2026
1 task done
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
Each TensorRT-LLM sidecar generation request now gets a child of the engine shutdown token,
self.cancel.child_token(). This matches the vLLM (#14726) and SGLang (#14727) sidecars.The problem.
select!re-pollsshutdown.cancelled()for every gRPC message.Notify::poll_notifiedtakes that one token's waiter mutex on each poll, so every in-flight stream contends on a single lock once per streamed token.Why behaviour is unchanged. A child token is cancelled when its parent is, so
cleanup()still ends in-flight streams. Request cancellation is untouched.Measured A/B. Setup:
self.cancel.clone()self.cancel.child_token()The stock ceiling. With
clone()the sidecar topped out at about 0.93–0.97M tok/s and 950–980 req/s, however much concurrency or mock capacity was added. In that state:futex_do_wait;parking_lotlock slow paths underWaitForCancellationFuturetook 18–45% of sidecar CPU;Measurement notes. One mock TRT-LLM server caps at about 0.8–1M tok/s, so the A/B used four mock processes sharing the gRPC port through a benchmark-only
SO_REUSEPORTpatch to the mock. That patch is not part of this PR. The numbers were measured atb93847f8ef; this PR applies the same one-line change to current main.Validation
cargo test --locked -p dynamo-trtllm-sidecar --lib: 51 passed, 2 ignored. This includes:cleanup_terminates_an_in_flight_requestanda_cancelled_decode_dispatch_is_not_abandoned_mid_flight(shutdown still terminates in-flight streams and releases a pending dispatch);cargo fmt -p dynamo-trtllm-sidecar -- --checkandgit diff --checkpassed.Related Issues
🤖 Generated with Claude Code
Summary by CodeRabbit