Skip to main content

dynamo_bench/kv_router/common/
args.rs

1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4/// Shared CLI arguments for trace-based benchmarks.
5#[derive(clap::Args, Debug)]
6pub struct CommonArgs {
7    /// Path to a JSONL mooncake trace file.
8    pub mooncake_trace_path: Option<String>,
9
10    /// Deprecated compatibility flag. Use `cargo test --package dynamo-bench --test ...`
11    /// for the fixture-backed integration tests instead.
12    #[clap(long)]
13    pub test: bool,
14
15    /// Number of GPU blocks available in the mock engine's KV cache.
16    #[clap(long, default_value = "16384")]
17    pub num_gpu_blocks: usize,
18
19    /// Number of tokens per KV cache block.
20    #[clap(long, default_value = "128")]
21    pub block_size: u32,
22
23    /// Optional wall-clock duration (ms) used to rescale the trace during event generation.
24    /// Omit to preserve the original Mooncake timestamps.
25    #[clap(long)]
26    pub trace_simulation_duration_ms: Option<u64>,
27
28    /// Wall-clock duration (ms) over which the benchmark replays operations.
29    #[clap(long, default_value = "60000")]
30    pub benchmark_duration_ms: u64,
31
32    /// Number of unique simulated inference workers.
33    #[clap(short, long, default_value = "1000")]
34    pub num_unique_inference_workers: usize,
35
36    /// How many times to duplicate unique workers during the benchmark phase.
37    #[clap(short = 'd', long, default_value = "1")]
38    pub inference_worker_duplication_factor: usize,
39
40    /// Factor by which to stretch each request's hash sequence length.
41    #[clap(long, default_value = "1")]
42    pub trace_length_factor: usize,
43
44    /// How many times to duplicate the raw trace data with offset hash_ids.
45    #[clap(long, default_value = "1")]
46    pub trace_duplication_factor: usize,
47
48    /// RNG seed for reproducible worker-to-trace assignment.
49    #[clap(long, default_value = "42")]
50    pub seed: u64,
51
52    /// Enable throughput vs p99 latency sweep mode.
53    #[clap(long)]
54    pub sweep: bool,
55
56    /// Minimum benchmark duration (ms) for sweep mode.
57    #[clap(long, default_value = "1000")]
58    pub sweep_min_ms: u64,
59
60    /// Maximum benchmark duration (ms) for sweep mode.
61    #[clap(long, default_value = "50000")]
62    pub sweep_max_ms: u64,
63
64    /// Number of logarithmically spaced sweep steps between min and max.
65    #[clap(long, default_value = "10")]
66    pub sweep_steps: usize,
67
68    /// Ignored - passed by cargo bench harness.
69    #[arg(long, hide = true, global = true)]
70    pub bench: bool,
71
72    /// Opt in to runtime warn/error logs from the mocker and sequence tracker.
73    #[clap(long)]
74    pub sequence_logs: bool,
75}