-
Notifications
You must be signed in to change notification settings - Fork 764
feat: allow in-cluster perf benchmarks with a kubectl one-liner #3144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hhzhang16
merged 28 commits into
main
from
hannahz/dyn-973-allow-in-cluster-perf-benchmarks-kubectl-one-liner
Sep 23, 2025
Merged
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
558482d
feat: initial benchmarking wrapper in-cluster work
hhzhang16 7cc6edb
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 5a09233
feat: update benchmark job for in-cluster benchmarking following late…
hhzhang16 8f19a4d
feat: update in-cluster benchmark job and yaml
hhzhang16 3ff6675
feat: enhance GPT OSS frontend with improved harmony tool calling par…
zhongdaor-nv 9482320
feat(operator): mechanism for disabling imagePullSecrets discovery (#…
tmonty12 f7cc9e9
refactor: simplify Dockerfile.vllm, enable local-dev for all framewor…
keivenchang d5f0495
feat: Request Cancellation unary request support (#3004)
kthui 1648836
build: update trtllm to v1.1.0rc5 to enable trtllm + KVBM integration…
richardhuo-nv 91181f6
build: OPS-597, OPS-861 restructure TRT-LLM to follow container strat…
nv-tusharma 89e074c
feat: Sglang canary health check (#3103)
tzulingk 271ef47
feat: Convert message[content] from list to string. (#3067)
KrishnanPrash f79e57b
feat: KVBM connector : enabling vectorized copy from pinned memory to…
oandreeva-nv 8ee077f
feat: update READMe commands
hhzhang16 4ac8147
feat: update READMe commands
hhzhang16 e7ed272
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 534ba19
docs: move in-cluster benchmarking doc to the overall benchmarking do…
hhzhang16 0235ece
feat: minor adjustments based on self look-through and coderabbit com…
hhzhang16 b392205
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 ef92388
docs: add benchmarking cross-namespace
hhzhang16 69bcfa8
docs: have user modify benchmark job instead of using envsubst
hhzhang16 e83590b
docs: add tldr
hhzhang16 efd16d6
docs: minor doc updates
hhzhang16 ae9e70e
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 5131348
docs: update k8s-related stuff in benchmarking.md
hhzhang16 38955ef
Merge branch 'main' into hannahz/dyn-973-allow-in-cluster-perf-benchm…
hhzhang16 a5e5b18
docs: updating client-side prereqs
hhzhang16 de853cf
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| <!-- # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. --> | ||
|
|
||
| # In-Cluster Benchmarking | ||
|
|
||
| This in-cluster benchmarking solution runs Dynamo benchmarks directly within a Kubernetes cluster, eliminating the need for port forwarding and providing better resource utilization. | ||
|
|
||
| ## What This Tool Does | ||
|
|
||
| The in-cluster benchmarking solution: | ||
| - Runs benchmarks directly within the Kubernetes cluster using internal service URLs | ||
| - Uses Kubernetes service DNS for direct communication (no port forwarding required) | ||
| - Leverages the existing benchmarking infrastructure (`benchmarks.utils.benchmark`) | ||
| - Stores results persistently using `dynamo-pvc` | ||
| - Provides isolated execution environment with configurable resources | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. **Kubernetes cluster** with NVIDIA GPUs and Dynamo namespace setup (see [Dynamo Cloud/Platform docs](../../docs/guides/dynamo_deploy/README.md)) | ||
| 2. **Storage and service account** PersistentVolumeClaim and service account configured with appropriate permissions (see [deploy/utils README](../../deploy/utils/README.md)) | ||
| 3. **Docker image** containing the Dynamo benchmarking tools | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Step 1: Deploy Your DynamoGraphDeployment | ||
| Deploy your DynamoGraphDeployment using the [deployment documentation](../../components/backends/). Ensure it has a frontend service exposed. | ||
|
|
||
| ### Step 2: Deploy and Run Benchmark Job | ||
|
|
||
| **Option A: Set environment variables (recommended for multiple commands)** | ||
| ```bash | ||
| # Set environment variables for your deployment | ||
| export NAMESPACE=benchmarking | ||
| export MODEL_NAME=Qwen/Qwen3-0.6B | ||
| export INPUT_NAME=qwen-vllm-agg | ||
| export SERVICE_URL=vllm-agg-frontend:8000 | ||
| export DOCKER_IMAGE=nvcr.io/nvidian/dynamo-dev/vllm-runtime:dyn-973.0 | ||
|
|
||
| # Deploy the benchmark job | ||
| envsubst < benchmark_job.yaml | kubectl apply -f - | ||
|
|
||
| # Monitor the job | ||
| kubectl logs -f job/dynamo-benchmark -n $NAMESPACE | ||
|
|
||
| # Check job status | ||
| kubectl get jobs -n $NAMESPACE | ||
| ``` | ||
|
|
||
| **Option B: One-liner deployment** | ||
| ```bash | ||
| NAMESPACE=benchmarking MODEL_NAME=Qwen/Qwen3-0.6B INPUT_NAME=qwen-vllm-agg SERVICE_URL=vllm-agg-frontend:8000 DOCKER_IMAGE=nvcr.io/nvidian/dynamo-dev/vllm-runtime:dyn-973.0 envsubst < benchmarks/incluster/benchmark_job.yaml | kubectl apply -f - | ||
| ``` | ||
|
|
||
| ### Step 3: Retrieve Results | ||
| ```bash | ||
| # Download results from PVC (recommended) | ||
| python3 -m deploy.utils.download_pvc_results \ | ||
| --namespace $NAMESPACE \ | ||
| --output-dir ./benchmarks/results/${INPUT_NAME} \ | ||
| --folder /data/results/${INPUT_NAME} \ | ||
| --no-config | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The benchmark job is fully configurable through environment variables: | ||
|
|
||
| ### Required Environment Variables | ||
|
|
||
| - **NAMESPACE**: Kubernetes namespace where the benchmark will run | ||
| - **MODEL_NAME**: Hugging Face model identifier (e.g., `Qwen/Qwen3-0.6B`) | ||
| - **INPUT_NAME**: Name identifier for the benchmark input (e.g., `qwen-agg`) | ||
| - **SERVICE_URL**: Internal service URL for the DynamoGraphDeployment frontend | ||
| - **DOCKER_IMAGE**: Docker image containing the Dynamo benchmarking tools | ||
|
|
||
| ## Understanding Your Results | ||
|
|
||
| Results are stored in `/data/results` and follow the same structure as local benchmarking: | ||
|
|
||
| ```text | ||
| /data/results/ | ||
| ├── plots/ # Performance visualization plots | ||
| │ ├── SUMMARY.txt # Human-readable benchmark summary | ||
| │ ├── p50_inter_token_latency_vs_concurrency.png | ||
| │ ├── avg_inter_token_latency_vs_concurrency.png | ||
| │ ├── request_throughput_vs_concurrency.png | ||
| │ ├── efficiency_tok_s_gpu_vs_user.png | ||
| │ └── avg_time_to_first_token_vs_concurrency.png | ||
| └── dsr1/ # Results for dsr1 input | ||
| ├── c1/ # Concurrency level 1 | ||
| │ └── profile_export_genai_perf.json | ||
| ├── c2/ # Concurrency level 2 | ||
| └── ... # Other concurrency levels | ||
| ``` | ||
|
|
||
| ## Monitoring and Debugging | ||
|
|
||
| ### Check Job Status | ||
| ```bash | ||
| kubectl get jobs -n $NAMESPACE | ||
| kubectl describe job dynamo-benchmark -n $NAMESPACE | ||
| ``` | ||
|
|
||
| ### View Logs | ||
| ```bash | ||
| # Follow logs in real-time | ||
| kubectl logs -f job/dynamo-benchmark -n $NAMESPACE | ||
|
|
||
| # Get logs from specific container | ||
| kubectl logs job/dynamo-benchmark -c benchmark-runner -n $NAMESPACE | ||
| ``` | ||
|
|
||
| ### Debug Failed Jobs | ||
| ```bash | ||
| # Check pod status | ||
| kubectl get pods -n $NAMESPACE -l job-name=dynamo-benchmark | ||
|
|
||
| # Describe failed pod | ||
| kubectl describe pod <pod-name> -n $NAMESPACE | ||
| ``` | ||
|
|
||
| ## Comparison with Local Benchmarking | ||
|
|
||
| | Feature | Local Benchmarking | In-Cluster Benchmarking | | ||
| |---------|-------------------|------------------------| | ||
| | Port Forwarding | Required | Not needed | | ||
| | Resource Usage | Local machine | Cluster resources | | ||
| | Network Latency | Higher (port-forward) | Lower (direct service) | | ||
| | Scalability | Limited | High | | ||
| | Isolation | Shared environment | Isolated job | | ||
| | Results Storage | Local filesystem | Persistent PVC | | ||
|
|
||
| The in-cluster approach is recommended for: | ||
| - Production benchmarking | ||
| - Multiple deployment comparisons | ||
| - Resource-constrained environments | ||
| - Automated CI/CD pipelines | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| 1. **Service not found**: Ensure your DynamoGraphDeployment frontend service is running | ||
| 2. **Service account permissions**: Verify `dynamo-sa` has necessary RBAC permissions | ||
| 3. **PVC access**: Check that `dynamo-pvc` is properly configured and accessible | ||
| 4. **Image pull issues**: Ensure the Docker image is accessible from the cluster | ||
| 5. **Resource constraints**: Adjust resource limits if the job is being evicted | ||
|
|
||
| ### Debug Commands | ||
|
|
||
| ```bash | ||
| # Check PVC status | ||
| kubectl get pvc dynamo-pvc -n $NAMESPACE | ||
|
|
||
| # Verify service account | ||
| kubectl get sa dynamo-sa -n $NAMESPACE | ||
|
|
||
| # Check service endpoints | ||
| kubectl get svc -n $NAMESPACE | ||
|
|
||
| # Verify your service URL is accessible | ||
| kubectl get svc $SERVICE_URL -n $NAMESPACE | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: dynamo-benchmark | ||
| namespace: ${NAMESPACE} | ||
| spec: | ||
| template: | ||
| spec: | ||
| serviceAccountName: dynamo-sa | ||
| imagePullSecrets: | ||
| - name: docker-imagepullsecret | ||
| containers: | ||
| - name: benchmark-runner | ||
| image: ${DOCKER_IMAGE} | ||
| resources: | ||
| requests: | ||
| cpu: "4" | ||
| memory: "8Gi" | ||
| limits: | ||
| cpu: "8" | ||
| memory: "16Gi" | ||
| env: | ||
| - name: HUGGING_FACE_HUB_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: hf-token-secret | ||
| key: HF_TOKEN | ||
biswapanda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: NATS_SERVER | ||
| value: nats://${NAMESPACE}-nats:4222 | ||
| - name: ETCD_ENDPOINTS | ||
| value: ${NAMESPACE}-etcd:2379 | ||
| command: ["python3", "-m", "benchmarks.utils.benchmark"] | ||
| args: | ||
| - --model | ||
| - ${MODEL_NAME} | ||
| - --isl | ||
biswapanda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - "2000" | ||
| - --std | ||
| - "10" | ||
| - --osl | ||
| - "256" | ||
| - --output-dir | ||
| - /data/results | ||
| - --input | ||
| - ${INPUT_NAME}=${SERVICE_URL} | ||
| volumeMounts: | ||
| - name: data-volume | ||
| mountPath: /data | ||
| restartPolicy: Never | ||
| volumes: | ||
| - name: data-volume | ||
| persistentVolumeClaim: | ||
| claimName: dynamo-pvc | ||
| backoffLimit: 0 | ||
| ttlSecondsAfterFinished: 3600 # Clean up job after 1 hour | ||
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.