Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 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 Sep 8, 2025
7cc6edb
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 Sep 18, 2025
5a09233
feat: update benchmark job for in-cluster benchmarking following late…
hhzhang16 Sep 18, 2025
8f19a4d
feat: update in-cluster benchmark job and yaml
hhzhang16 Sep 19, 2025
3ff6675
feat: enhance GPT OSS frontend with improved harmony tool calling par…
zhongdaor-nv Sep 18, 2025
9482320
feat(operator): mechanism for disabling imagePullSecrets discovery (#…
tmonty12 Sep 18, 2025
f7cc9e9
refactor: simplify Dockerfile.vllm, enable local-dev for all framewor…
keivenchang Sep 19, 2025
d5f0495
feat: Request Cancellation unary request support (#3004)
kthui Sep 19, 2025
1648836
build: update trtllm to v1.1.0rc5 to enable trtllm + KVBM integration…
richardhuo-nv Sep 19, 2025
91181f6
build: OPS-597, OPS-861 restructure TRT-LLM to follow container strat…
nv-tusharma Sep 19, 2025
89e074c
feat: Sglang canary health check (#3103)
tzulingk Sep 19, 2025
271ef47
feat: Convert message[content] from list to string. (#3067)
KrishnanPrash Sep 19, 2025
f79e57b
feat: KVBM connector : enabling vectorized copy from pinned memory to…
oandreeva-nv Sep 19, 2025
8ee077f
feat: update READMe commands
hhzhang16 Sep 19, 2025
4ac8147
feat: update READMe commands
hhzhang16 Sep 19, 2025
e7ed272
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 Sep 19, 2025
534ba19
docs: move in-cluster benchmarking doc to the overall benchmarking do…
hhzhang16 Sep 19, 2025
0235ece
feat: minor adjustments based on self look-through and coderabbit com…
hhzhang16 Sep 19, 2025
b392205
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 Sep 22, 2025
ef92388
docs: add benchmarking cross-namespace
hhzhang16 Sep 22, 2025
69bcfa8
docs: have user modify benchmark job instead of using envsubst
hhzhang16 Sep 22, 2025
e83590b
docs: add tldr
hhzhang16 Sep 22, 2025
efd16d6
docs: minor doc updates
hhzhang16 Sep 22, 2025
ae9e70e
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 Sep 22, 2025
5131348
docs: update k8s-related stuff in benchmarking.md
hhzhang16 Sep 23, 2025
38955ef
Merge branch 'main' into hannahz/dyn-973-allow-in-cluster-perf-benchm…
hhzhang16 Sep 23, 2025
a5e5b18
docs: updating client-side prereqs
hhzhang16 Sep 23, 2025
de853cf
Merge branch 'main' of github.com:ai-dynamo/dynamo into hannahz/dyn-9…
hhzhang16 Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions benchmarks/incluster/README.md
67 changes: 67 additions & 0 deletions benchmarks/incluster/benchmark_job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# 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
spec:
template:
spec:
serviceAccountName: dynamo-sa
imagePullSecrets:
- name: docker-imagepullsecret
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: benchmark-runner
image: nvcr.io/nvidia/ai-dynamo/vllm-runtime:0.5.0
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
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
command: ["python3", "-m", "benchmarks.utils.benchmark"]
args:
- --model
- "Qwen/Qwen3-0.6B"
- --isl
- "2000"
- --std
- "10"
- --osl
- "256"
- --output-dir
- /data/results
- --input
- "qwen-vllm-agg=vllm-agg-frontend:8000"
# add more copies of lines 58-59 for each additional service if you want to benchmark multiple services
# - --input
# - "name=service-url:port"
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
48 changes: 27 additions & 21 deletions benchmarks/utils/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,59 @@
import re
import sys
from typing import Dict, Tuple
from urllib.parse import urlsplit

from benchmarks.utils.workflow import run_benchmark_workflow
from benchmarks.utils.workflow import has_http_scheme, run_benchmark_workflow
from deploy.utils.kubernetes import is_running_in_cluster


def validate_inputs(inputs: Dict[str, str]) -> None:
"""Validate that all inputs are HTTP endpoints"""
"""Validate that all inputs are HTTP endpoints or internal service URLs when running in cluster"""
for label, value in inputs.items():
if not value.lower().startswith(("http://", "https://")):
raise ValueError(
f"Input '{label}' must be an HTTP endpoint (starting with http:// or https://). Got: {value}"
)
v = value.strip()
if is_running_in_cluster():
# Allow HTTP(S) or internal service URLs like host[:port][/path]
if has_http_scheme(v):
pass
else:
parts = urlsplit(f"//{v}")
host_ok = bool(parts.hostname)
port_ok = parts.port is None or (1 <= parts.port <= 65535)
if not (host_ok and port_ok):
raise ValueError(
f"Input '{label}' must be HTTP(S) or internal service URL. Got: {value}"
)
else:
if not has_http_scheme(v):
raise ValueError(f"Input '{label}' must be HTTP endpoint. Got: {value}")

# Validate reserved labels
if label.lower() == "plots":
raise ValueError(
"Label 'plots' is reserved and cannot be used. Please choose a different label."
)
raise ValueError("Label 'plots' is reserved")


def parse_input(input_str: str) -> Tuple[str, str]:
"""Parse input string in format key=value with additional validation"""
if "=" not in input_str:
raise ValueError(
f"Invalid input format. Expected: <label>=<endpoint>, got: {input_str}"
)
raise ValueError(f"Invalid input format: {input_str}")

parts = input_str.split("=", 1) # Split on first '=' only
if len(parts) != 2:
raise ValueError(
f"Invalid input format. Expected: <label>=<endpoint>, got: {input_str}"
)
raise ValueError(f"Invalid input format: {input_str}")

label, value = parts

if not label.strip():
raise ValueError("Label cannot be empty")
raise ValueError("Empty label")
if not value.strip():
raise ValueError("Value cannot be empty")
raise ValueError("Empty value")

label = label.strip()
value = value.strip()

# Validate label characters
if not re.match(r"^[a-zA-Z0-9_-]+$", label):
raise ValueError(
f"Label must contain only letters, numbers, hyphens, and underscores. Invalid label: {label}"
)
raise ValueError(f"Invalid label: {label}")

return label, value

Expand Down Expand Up @@ -114,7 +120,7 @@ def main() -> int:
)
print()

# Validate that all inputs are HTTP endpoints
# Validate that inputs are HTTP endpoints or in-cluster service URLs
validate_inputs(parsed_inputs)

except ValueError as e:
Expand Down
24 changes: 21 additions & 3 deletions benchmarks/utils/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@

from benchmarks.utils.genai import run_concurrency_sweep
from benchmarks.utils.plot import generate_plots
from deploy.utils.kubernetes import is_running_in_cluster


def has_http_scheme(url: str) -> bool:
"""Check if URL has HTTP or HTTPS scheme."""
return url.lower().startswith(("http://", "https://"))


def normalize_service_url(endpoint: str) -> str:
e = endpoint.strip()
if has_http_scheme(e):
return e
if is_running_in_cluster():
return f"http://{e}"
return e # Outside cluster, validation will have ensured scheme is present


def print_concurrency_start(
Expand All @@ -30,15 +45,18 @@ def run_endpoint_benchmark(
output_dir: Path,
) -> None:
"""Run benchmark for an existing endpoint with custom label"""
print(f"🚀 Starting benchmark of endpoint '{label}': {endpoint}")
# Normalize endpoint to a usable URL (handles in-cluster scheme-less inputs)
service_url = normalize_service_url(endpoint)

print(f"🚀 Starting benchmark of endpoint '{label}': {service_url}")
print(f"📁 Results will be saved to: {output_dir / label}")
print_concurrency_start(label, model, isl, osl, std)

# Create output directory
(output_dir / label).mkdir(parents=True, exist_ok=True)

run_concurrency_sweep(
service_url=endpoint,
service_url=service_url,
model_name=model,
isl=isl,
osl=osl,
Expand Down Expand Up @@ -73,7 +91,7 @@ def run_benchmark_workflow(
model: str = "Qwen/Qwen3-0.6B",
output_dir: str = "benchmarks/results",
) -> None:
"""Main benchmark workflow orchestrator for HTTP endpoints only"""
"""Main benchmark workflow orchestrator for HTTP endpoints (and in-cluster internal service URLs)"""
output_dir_path = Path(output_dir)
output_dir_path.mkdir(parents=True, exist_ok=True)

Expand Down
9 changes: 9 additions & 0 deletions deploy/utils/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import subprocess
import sys
from pathlib import Path
from typing import List

PVC_ACCESS_POD_NAME = "pvc-access-pod"

K8S_SA_TOKEN = Path("/var/run/secrets/kubernetes.io/serviceaccount/token")


def is_running_in_cluster() -> bool:
"""Return True if running inside a Kubernetes cluster."""
# Prefer well-known env var; fall back to SA token presence
return bool(os.environ.get("KUBERNETES_SERVICE_HOST")) or K8S_SA_TOKEN.exists()


def run_command(
cmd: List[str], capture_output: bool = True, exit_on_error: bool = True
Expand Down
Loading
Loading