-
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 1 commit
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
Next
Next commit
feat: initial benchmarking wrapper in-cluster work
Signed-off-by: Hannah Zhang <[email protected]>
- Loading branch information
commit 558482d29ecc67d0fbb839beeaa80e60ba5341a9
Some comments aren't visible on the classic Files Changed page.
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,245 @@ | ||
| # In-Cluster Benchmarking | ||
|
|
||
| This directory contains a simple Kubernetes Job manifest for running Dynamo benchmarks directly within a Kubernetes cluster, eliminating the need for port forwarding. | ||
|
|
||
| ## Overview | ||
|
|
||
| The in-cluster benchmarking solution consists of: | ||
|
|
||
| - **Kubernetes Job manifest** (`benchmark_job.yaml`) - Simple wrapper around the existing benchmarking infrastructure | ||
| - **Documentation** - Instructions for using the job manifest | ||
|
|
||
| ## Key Benefits | ||
|
|
||
| - **No port forwarding required** - Uses Kubernetes service DNS for direct communication | ||
| - **Better resource utilization** - Runs within the cluster alongside your deployments | ||
| - **Persistent results** - Uses `dynamo-pvc` for storing manifests and results | ||
| - **Simple deployment** - Just edit the YAML and run `kubectl apply -f` | ||
| - **Uses existing infrastructure** - Leverages the existing `/benchmarks` and `/benchmarks/utils` code | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| 1. **Kubernetes cluster** with NVIDIA GPUs and Dynamo namespace setup (see [Dynamo Cloud/Platform docs](../../docs/guides/dynamo_deploy/README.md)) | ||
| 2. **dynamo-pvc** PersistentVolumeClaim configured (see [deploy/utils README](../../deploy/utils/README.md)) | ||
| 3. **Service account** (`dynamo-sa`) with appropriate permissions (see [deploy/utils README](../../deploy/utils/README.md)) | ||
| 4. **Docker image** containing the Dynamo benchmarking tools | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Edit the Job Manifest | ||
|
|
||
| Edit `benchmark_job.yaml` to specify your benchmark inputs: | ||
|
|
||
| ```yaml | ||
| # Set your namespace and docker image | ||
| NAMESPACE: your-namespace | ||
| DOCKER_IMAGE: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0 | ||
|
|
||
| # Add your --input arguments | ||
| INPUT_ARGS: --input agg=/manifests/agg.yaml --input disagg=/manifests/disagg.yaml | ||
| ``` | ||
|
|
||
| ### 2. Deploy and Run | ||
|
|
||
| ```bash | ||
| # Deploy the benchmark job | ||
| kubectl apply -f benchmark_job.yaml | ||
|
|
||
| # With a custom namespace | ||
| NAMESPACE=hannahz envsubst < benchmark_job.yaml | kubectl apply -f - | ||
|
|
||
| # Monitor the job | ||
| kubectl logs -f job/dynamo-benchmark -n your-namespace | ||
|
|
||
| # Check job status | ||
| kubectl get jobs -n your-namespace | ||
| ``` | ||
|
|
||
| ### 3. Retrieve Results | ||
|
|
||
| ```bash | ||
| # Copy results from PVC | ||
| kubectl cp <pod-name>:/results ./benchmark_results -n your-namespace | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| The job manifest supports these environment variables with reasonable defaults: | ||
|
|
||
| - `NAMESPACE` - Kubernetes namespace (default: benchmarking) | ||
| - `DOCKER_IMAGE` - Docker image to use (default: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0) | ||
| - `MODEL` - Model name (default: Qwen/Qwen3-0.6B) | ||
| - `ISL` - Input sequence length (default: 2000) | ||
| - `STD` - Input sequence standard deviation (default: 10) | ||
| - `OSL` - Output sequence length (default: 256) | ||
| - `INPUT_ARGS` - Your --input arguments (no default - you must specify these) | ||
|
|
||
| ### Input Arguments | ||
|
|
||
| Specify your benchmark inputs using the `INPUT_ARGS` variable: | ||
|
|
||
| ```yaml | ||
| # Compare DynamoGraphDeployment manifests | ||
| INPUT_ARGS: --input agg=/manifests/agg.yaml --input disagg=/manifests/disagg.yaml | ||
|
|
||
| # Compare Dynamo vs external services | ||
| INPUT_ARGS: --input dynamo=/manifests/dynamo.yaml --input external=http://external-service:8000 | ||
|
|
||
| # Single deployment benchmark | ||
| INPUT_ARGS: --input my-deployment=/manifests/my-config.yaml | ||
| ``` | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ### Compare Multiple Dynamo Deployments | ||
|
|
||
| ```yaml | ||
| # In benchmark_job.yaml | ||
| NAMESPACE: benchmarking | ||
| DOCKER_IMAGE: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0 | ||
| INPUT_ARGS: --input vllm-agg=/manifests/vllm-agg.yaml --input vllm-disagg=/manifests/vllm-disagg.yaml --input trtllm-agg=/manifests/trtllm-agg.yaml | ||
| ``` | ||
|
|
||
| ```bash | ||
| kubectl apply -f benchmark_job.yaml | ||
| kubectl logs -f job/dynamo-benchmark -n benchmarking | ||
| ``` | ||
|
|
||
| ### Compare Dynamo vs External Services | ||
|
|
||
| ```yaml | ||
| # In benchmark_job.yaml | ||
| NAMESPACE: benchmarking | ||
| DOCKER_IMAGE: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0 | ||
| INPUT_ARGS: --input dynamo=/manifests/dynamo-config.yaml --input external-vllm=http://external-vllm-service:8000 --input external-trtllm=http://external-trtllm-service:8000 | ||
| ``` | ||
|
|
||
| ```bash | ||
| kubectl apply -f benchmark_job.yaml | ||
| kubectl logs -f job/dynamo-benchmark -n benchmarking | ||
| ``` | ||
|
|
||
| ### Custom Model and Parameters | ||
|
|
||
| ```yaml | ||
| # In benchmark_job.yaml | ||
| NAMESPACE: benchmarking | ||
| DOCKER_IMAGE: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0 | ||
| MODEL: meta-llama/Meta-Llama-3-8B | ||
| ISL: 1500 | ||
| OSL: 200 | ||
| INPUT_ARGS: --input my-deployment=/manifests/my-config.yaml | ||
| ``` | ||
|
|
||
| ```bash | ||
| kubectl apply -f benchmark_job.yaml | ||
| kubectl logs -f job/dynamo-benchmark -n benchmarking | ||
| ``` | ||
|
|
||
| ## Job Manifest Structure | ||
|
|
||
| The job manifest includes: | ||
|
|
||
| - **Service Account**: Uses `dynamo-sa` for Kubernetes API access | ||
| - **Resource Limits**: Configurable CPU/memory limits | ||
| - **Environment Variables**: HuggingFace token, NATS, ETCD endpoints | ||
| - **Volume Mounts**: | ||
| - `/manifests`: Read-only access to deployment manifests | ||
| - `/results`: Read-write access for benchmark results | ||
| - **Cleanup**: Automatic job cleanup after 1 hour | ||
|
|
||
| ## 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> | ||
|
|
||
| # Get events | ||
| kubectl get events -n <namespace> --sort-by='.lastTimestamp' | ||
| ``` | ||
|
|
||
| ## Results Structure | ||
|
|
||
| Results are organized in the `/results` directory: | ||
|
|
||
| ``` | ||
| /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 | ||
| ├── <label-1>/ # Results for first input | ||
| │ ├── c1/ # Concurrency level 1 | ||
| │ │ └── profile_export_genai_perf.json | ||
| │ ├── c2/ # Concurrency level 2 | ||
| │ └── ... # Other concurrency levels | ||
| └── <label-N>/ # Results for additional inputs | ||
| └── c*/ # Same structure as above | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Common Issues | ||
|
|
||
| 1. **Manifest not found**: Ensure manifests are copied to `/manifests` in the PVC | ||
| 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 RBAC permissions | ||
| kubectl auth can-i create dynamographdeployments --as=system:serviceaccount:<namespace>:dynamo-sa -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 |
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,65 @@ | ||
| # 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: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0 | ||
| 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 | ||
| - name: NATS_SERVER | ||
| value: nats://${NAMESPACE}-nats:4222 | ||
| - name: ETCD_ENDPOINTS | ||
| value: ${NAMESPACE}-etcd:2379 | ||
| command: ["python3", "-m", "benchmarks.utils.benchmark"] | ||
| args: | ||
| - --namespace | ||
| - ${NAMESPACE} | ||
| - --model | ||
| - Qwen/Qwen3-0.6B | ||
| - --isl | ||
biswapanda marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - "2000" | ||
| - --std | ||
| - "10" | ||
| - --osl | ||
| - "256" | ||
| - --output-dir | ||
| - /data/results | ||
| # Add your --input arguments here | ||
| # Example: --input agg=/manifests/agg.yaml --input disagg=/manifests/disagg.yaml | ||
| # Example: --input external=http://external-service:8000 | ||
| - --input | ||
| - agg=/workspace/components/backends/vllm/deploy/agg.yaml | ||
| - --input | ||
| - disagg=/workspace/components/backends/vllm/deploy/disagg.yaml | ||
| 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
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.