KEMBAR78
[https://nvbugs/5522847][fix] Disable GC on disagg server and client by yuantailing · Pull Request #7858 · NVIDIA/TensorRT-LLM · GitHub
Skip to content

Conversation

@yuantailing
Copy link
Member

@yuantailing yuantailing commented Sep 19, 2025

In disaggregated serving and wide-ep scenarios, concurrency is high, so host overhead becomes a problem.
Whether GC in disagg server is enabled is a significant factor affecting performance.
The following table compares the "Output token throughput":

  ctx4_gen1_dep32_batch256_eplb0_mtp1
disagg server GC enabled 187466.23
disagg server GC disabled 240964.24

To reproduce the performance, use code from https://github.com/NVIDIA/TensorRT-LLM/commits/8881f125f8b8dbc9c5aa91e97acaa7b43522affd/ (1 commit ahead of release/1.1.0rc2)

Summary by CodeRabbit

  • New Features
    • Disaggregated serving now disables Python’s garbage collector by default. Control via environment variable TRTLLM_DISAGG_SERVER_DISABLE_GC (default: 1). Set to 0 to re-enable GC.
  • Chores
    • Benchmarking script updated to disable GC during dataset creation and sampling to reduce overhead.

Impact: Improved performance and stability in disaggregated serving and benchmarking workloads, with an opt-out switch for environments that prefer default GC behavior.

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

📝 Walkthrough

Walkthrough

Introduces conditional Python garbage collector disabling. In disaggregated server mode, GC is disabled by default via an environment variable gate. In the benchmarking script, previous gc.collect/freeze handling is replaced with a simple gc.disable() during dataset/sample preparation.

Changes

Cohort / File(s) Summary
Disaggregated server GC control
tensorrt_llm/commands/serve.py
Imports gc. In disaggregated(...), reads env TRTLLM_DISAGG_SERVER_DISABLE_GC (default 1); if non-zero, calls gc.disable() before starting the server loop.
Benchmark GC handling
tensorrt_llm/serve/scripts/benchmark_serving.py
In create_dataset_and_sample, replaces gc.collect() and gc.freeze() with gc.disable(); updates comment accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User/CLI
  participant S as Disaggregated Server
  participant OS as Env
  participant GC as Python GC

  U->>S: Start disaggregated(...)
  S->>OS: Read TRTLLM_DISAGG_SERVER_DISABLE_GC (default 1)
  alt value != 0
    S->>GC: disable()
    note right of S: GC disabled for server runtime
  else value == 0
    note right of S: GC remains enabled
  end
  S->>S: Initialize and enter serve loop
Loading
sequenceDiagram
  autonumber
  participant B as benchmark_serving.py
  participant GC as Python GC

  B->>B: create_dataset_and_sample(...)
  B->>GC: disable()
  B->>B: Build dataset and sample
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The PR description is incomplete relative to the repository's required template: the "Description" and "Test Coverage" sections are empty, the PR title does not follow the required [ticket][type] format or the @coderabbitai helper, and the body only contains a performance table and a reproduction commit reference. The raw_summary shows concrete code changes (disabling Python GC in tensorrt_llm/commands/serve.py behind the TRTLLM_DISAGG_SERVER_DISABLE_GC env var and changing GC handling in tensorrt_llm/serve/scripts/benchmark_serving.py) that are not summarized, and there are no documented tests, compatibility notes, or reviewer guidance. Because required template fields and test coverage details are missing, this check fails. Please update the PR to follow the repository template: set the PR title to the required [ticket][type] format or use "@coderabbitai title" and fill the "Description" with a concise summary of what changed (files, behavior, the new env var TRTLLM_DISAGG_SERVER_DISABLE_GC and its default, and why), include the performance numbers and reproduction steps, and populate "Test Coverage" with explicit tests or manual repro steps and CI expectations. Also confirm PR checklist items such as CODEOWNERS and documentation updates, and add links to benchmark runs and any new tests so reviewers can validate the performance claims. After those additions the description can be re-evaluated.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[https://nvbugs/5522847][fix] Disable GC on disagg server and client" concisely and accurately captures the primary change to disable Python garbage collection in disaggregated server and client code. It follows the repository's ticket-format convention and includes the correct change type ([fix]). The wording is specific and clear enough for a reviewer scanning history to understand the main intent.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yuantailing
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19287 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19287 [ run ] completed with state ABORTED
LLM/main/L0_MergeRequest_PR #14486 (Blue Ocean) completed with status: ABORTED

@yuantailing yuantailing changed the title Disable GC on disagg server and client [https://nvbugs/5522847][fix] Disable GC on disagg server and client Sep 19, 2025
Signed-off-by: Tailing Yuan <yuantailing@gmail.com>
@yuantailing
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19339 [ run ] triggered by Bot

@yuantailing
Copy link
Member Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19429 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19429 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #14598 completed with status: 'FAILURE'

@kaiyux
Copy link
Member

kaiyux commented Sep 22, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19468 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19468 [ run ] completed with state FAILURE
/LLM/main/L0_MergeRequest_PR pipeline #14637 completed with status: 'FAILURE'

@kaiyux
Copy link
Member

kaiyux commented Sep 22, 2025

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19590 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19590 [ run ] completed with state SUCCESS
/LLM/main/L0_MergeRequest_PR pipeline #14732 completed with status: 'SUCCESS'

@kaiyux kaiyux merged commit 740340d into NVIDIA:main Sep 23, 2025
6 of 7 checks passed
@yuantailing yuantailing deleted the disagg_server_disable_gc branch September 28, 2025 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants