Skip to content

Conversation

@tedzhouhk
Copy link
Contributor

@tedzhouhk tedzhouhk commented Aug 4, 2025

Overview:

Details:

Where should the reviewer start?

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

Summary by CodeRabbit

  • Documentation

    • Updated documentation to use the correct environment variable and added a section with an example for testing deployments.
  • Chores

    • Improved health checks for services by switching to HTTP-based probes.
    • Increased CPU and memory resource allocations for improved performance.
    • Added startup probes and new environment variables for enhanced system configuration.
    • Updated container images for certain components.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Aug 4, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@tedzhouhk tedzhouhk marked this pull request as ready for review August 4, 2025 18:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Walkthrough

This update modifies the SGLang backend documentation and Kubernetes deployment YAMLs. Documentation now references $DYNAMO_HOME instead of $DYNAMO_ROOT and includes a test request example. Deployment YAMLs switch health probes from shell commands to HTTP GETs, increase resource allocations, add startup probes, update images, and introduce new environment variables.

Changes

Cohort / File(s) Change Summary
Documentation Update
components/backends/sglang/README.md
Replaced $DYNAMO_ROOT with $DYNAMO_HOME in commands; added section on testing deployment with a curl example.
Frontend Deployment Configuration
components/backends/sglang/deploy/agg.yaml, components/backends/sglang/deploy/agg_router.yaml, components/backends/sglang/deploy/disagg.yaml
Changed readiness probe from shell exit to HTTP GET with JSON health check; increased CPU and memory resource requests/limits.
SGLang Worker Deployments
components/backends/sglang/deploy/agg.yaml, components/backends/sglang/deploy/agg_router.yaml, components/backends/sglang/deploy/disagg.yaml
Updated liveness/readiness probes from shell to HTTP GET on /live and /health; added startup probes; increased CPU/memory limits; added DYN_SYSTEM-related environment variables; updated container images (in disagg.yaml).
Prefill Worker Deployment
components/backends/sglang/deploy/disagg.yaml
Applied the same probe, resource, environment, and image updates as for the decode worker.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend (K8s Pod)
    participant SGLang Worker (K8s Pod)

    User->>Frontend (K8s Pod): Send request (e.g., via curl)
    Frontend (K8s Pod)->>Frontend (K8s Pod): Readiness probe (HTTP GET /health)
    Frontend (K8s Pod)-->>User: Responds if healthy

    Frontend (K8s Pod)->>SGLang Worker (K8s Pod): Forwards request
    SGLang Worker (K8s Pod)->>SGLang Worker (K8s Pod): Liveness/readiness/startup probes (HTTP GET /live, /health)
    SGLang Worker (K8s Pod)-->>Frontend (K8s Pod): Responds if healthy
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Poem

In YAML fields and README lines,
Probes now check with HTTP signs.
Memory grows, CPUs soar,
Health checks knock on every door.
A curl test hops in with pride—
This bunny’s backend is certified! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🔭 Outside diff range comments (1)
components/backends/sglang/deploy/agg_router.yaml (1)

20-28: exec probe now shells out to curl | jq – high coupling & requires jq

  1. The container image must contain jq, otherwise the probe will always fail.
  2. Mixing curl | jq inside an exec probe obscures intent; an HTTP-GET probe is simpler, faster and avoids extra binaries.
-      readinessProbe:
-        exec:
-          command:
-            - /bin/sh
-            - -c
-            - 'curl -s http://localhost:8000/health | jq -e ".status == \"healthy\""'
+      readinessProbe:
+        httpGet:
+          path: /health
+          port: 8000
+        successThreshold: 1
♻️ Duplicate comments (3)
components/backends/sglang/README.md (1)

138-155: Curl example is still very verbose – same concern as prior review
This mirrors the earlier feedback from @ishandhanani about shortening the example payload. Consider trimming the prompt or pointing to a separate snippet instead of inlining 15 lines.

components/backends/sglang/deploy/agg.yaml (1)

20-28: Same curl | jq pattern – convert to native HTTP-GET
Apply the same refactor as suggested for agg_router.yaml.

components/backends/sglang/deploy/disagg.yaml (1)

20-28: Switch Frontend readiness probe to HTTP-GET & drop jq dependency
Same rationale as previous files.

🧹 Nitpick comments (4)
components/backends/sglang/deploy/agg_router.yaml (1)

33-38: Huge gap between memory request (10 Gi) and limit (40 Gi)

A 4× delta can starve the node scheduler and hides real usage. Either raise the request or lower the limit to a realistic head-room (<2×).

components/backends/sglang/deploy/agg.yaml (1)

33-38: Frontend memory request vs limit mismatch (10 Gi vs 40 Gi)
Align requests with realistic usage to avoid over-commit surprises.

components/backends/sglang/deploy/disagg.yaml (2)

33-38: Memory request / limit skew (10 Gi → 40 Gi)
Consider tightening this gap for predictable bin-packing.


49-55: Worker liveness probe period 5 s with heavy model load

Decoding workers often spike >5 s under load; premature restarts are likely. A 15-20 s period with 3 failures is more forgiving while still responsive.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fed066 and 5d8b3f7.

📒 Files selected for processing (4)
  • components/backends/sglang/README.md (3 hunks)
  • components/backends/sglang/deploy/agg.yaml (4 hunks)
  • components/backends/sglang/deploy/agg_router.yaml (4 hunks)
  • components/backends/sglang/deploy/disagg.yaml (5 hunks)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: julienmancuso
PR: ai-dynamo/dynamo#2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:1178-1180
Timestamp: 2025-07-18T16:05:05.534Z
Learning: The stopSignal field under lifecycle in DynamoComponentDeployment CRDs is autogenerated due to Kubernetes library upgrades (k8s.io/api and k8s.io/apimachinery from v0.32.3 to v0.33.1), not a manual design decision by the user.
Learnt from: julienmancuso
PR: ai-dynamo/dynamo#1365
File: deploy/cloud/operator/api/v1alpha1/dynamocomponentdeployment_types.go:171-178
Timestamp: 2025-06-04T13:09:53.416Z
Learning: The `DYN_DEPLOYMENT_CONFIG` environment variable (commonconsts.DynamoDeploymentConfigEnvVar) in the Dynamo operator will never be set via ValueFrom (secrets/config maps), only via direct Value assignment. The GetDynamoDeploymentConfig method correctly only checks env.Value for this specific environment variable.
Learnt from: julienmancuso
PR: ai-dynamo/dynamo#2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamographdeployments.yaml:1233-1235
Timestamp: 2025-07-18T16:04:47.465Z
Learning: The `stopSignal` field in Kubernetes CRDs like DynamoGraphDeployment and DynamoComponentDeployment is autogenerated by controller-gen when upgrading Kubernetes library versions, and represents expected upstream API changes rather than manual code that needs custom validation.
📚 Learning: in components/backends/sglang/deploy/agg_router.yaml, the clear_namespace command is intentionally d...
Learnt from: biswapanda
PR: ai-dynamo/dynamo#2137
File: components/backends/sglang/deploy/agg_router.yaml:0-0
Timestamp: 2025-07-28T17:00:07.968Z
Learning: In components/backends/sglang/deploy/agg_router.yaml, the clear_namespace command is intentionally designed to block the router from starting if it fails (using &&). This is a deliberate design decision where namespace clearing is a critical prerequisite and the router should not start with an uncleared namespace.

Applied to files:

  • components/backends/sglang/README.md
  • components/backends/sglang/deploy/agg_router.yaml
📚 Learning: in examples/sglang/slurm_jobs/scripts/worker_setup.py, background processes (like nats-server, etcd)...
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/scripts/worker_setup.py:230-244
Timestamp: 2025-07-03T10:14:30.570Z
Learning: In examples/sglang/slurm_jobs/scripts/worker_setup.py, background processes (like nats-server, etcd) are intentionally left running even if later processes fail. This design choice allows users to manually connect to nodes and debug issues without having to restart the entire SLURM job from scratch, providing operational flexibility for troubleshooting in cluster environments.

Applied to files:

  • components/backends/sglang/README.md
  • components/backends/sglang/deploy/agg_router.yaml
  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: in the slurm job script template at examples/sglang/slurm_jobs/job_script_template.j2, the `--total_...
Learnt from: fsaady
PR: ai-dynamo/dynamo#1730
File: examples/sglang/slurm_jobs/job_script_template.j2:59-59
Timestamp: 2025-07-02T13:20:28.800Z
Learning: In the SLURM job script template at examples/sglang/slurm_jobs/job_script_template.j2, the `--total_nodes` parameter represents the total nodes per worker type (prefill or decode), not the total nodes in the entire cluster. Each worker type needs to know its own group size for distributed coordination.

Applied to files:

  • components/backends/sglang/README.md
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: in fault tolerance test configurations, the `resources` section under `serviceargs` specifies resour...
Learnt from: nnshah1
PR: ai-dynamo/dynamo#1444
File: tests/fault_tolerance/configs/agg_tp_1_dp_8.yaml:31-38
Timestamp: 2025-07-01T15:33:53.262Z
Learning: In fault tolerance test configurations, the `resources` section under `ServiceArgs` specifies resources per individual worker, not total resources for all workers. So `workers: 8` with `gpu: '1'` means 8 workers × 1 GPU each = 8 GPUs total.

Applied to files:

  • components/backends/sglang/README.md
  • components/backends/sglang/deploy/agg_router.yaml
  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: in vllm worker deployments, startup probes (with longer periods and higher failure thresholds like p...
Learnt from: nnshah1
PR: ai-dynamo/dynamo#2124
File: components/backends/vllm/deploy/disagg.yaml:54-60
Timestamp: 2025-07-25T22:34:11.384Z
Learning: In vLLM worker deployments, startup probes (with longer periods and higher failure thresholds like periodSeconds: 10, failureThreshold: 60) are used to handle the slow model loading startup phase, while liveness probes are intentionally kept aggressive (periodSeconds: 5, failureThreshold: 1) for quick failure detection once the worker is operational. This pattern separates startup concerns from operational health monitoring in GPU-heavy workloads.

Applied to files:

  • components/backends/sglang/deploy/agg_router.yaml
  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: in vllm worker deployments, grep-based log checks for "vllmworker.*has been initialized" are appropr...
Learnt from: biswapanda
PR: ai-dynamo/dynamo#1890
File: examples/vllm/deploy/agg.yaml:63-70
Timestamp: 2025-07-14T23:01:16.218Z
Learning: In vLLM worker deployments, grep-based log checks for "VllmWorker.*has been initialized" are appropriate for readiness probes to verify worker startup, but should not be used for liveness probes which need to detect ongoing worker health.

Applied to files:

  • components/backends/sglang/deploy/agg_router.yaml
  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: in the dynamo operator, the project’s preferred security posture is to set a pod-level `podsecurityc...
Learnt from: julienmancuso
PR: ai-dynamo/dynamo#1474
File: deploy/cloud/operator/internal/controller/dynamocomponent_controller.go:1302-1306
Timestamp: 2025-06-11T21:18:00.425Z
Learning: In the Dynamo operator, the project’s preferred security posture is to set a Pod-level `PodSecurityContext` with `runAsUser`, `runAsGroup`, and `fsGroup` all set to `1000`, and then selectively override the user at the individual container level (e.g., `RunAsUser: 0` for Kaniko) when root is required.

Applied to files:

  • components/backends/sglang/deploy/agg_router.yaml
  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
📚 Learning: the stopsignal field under lifecycle in dynamocomponentdeployment crds is autogenerated due to kuber...
Learnt from: julienmancuso
PR: ai-dynamo/dynamo#2012
File: deploy/cloud/helm/crds/templates/nvidia.com_dynamocomponentdeployments.yaml:1178-1180
Timestamp: 2025-07-18T16:05:05.534Z
Learning: The stopSignal field under lifecycle in DynamoComponentDeployment CRDs is autogenerated due to Kubernetes library upgrades (k8s.io/api and k8s.io/apimachinery from v0.32.3 to v0.33.1), not a manual design decision by the user.

Applied to files:

  • components/backends/sglang/deploy/agg.yaml
  • components/backends/sglang/deploy/disagg.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pre-merge-rust (lib/bindings/python)
  • GitHub Check: pre-merge-rust (lib/runtime/examples)
  • GitHub Check: pre-merge-rust (.)
  • GitHub Check: Build and Test - vllm
🔇 Additional comments (1)
components/backends/sglang/deploy/disagg.yaml (1)

84-90: Prefill worker startupProbe checks /health, decode worker uses /live

Ensure both endpoints behave consistently; otherwise one worker type may never become Ready.

@tedzhouhk tedzhouhk merged commit 26dc628 into main Aug 4, 2025
11 checks passed
@tedzhouhk tedzhouhk deleted the hzhou/sglang_k8s branch August 4, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants