[model-gateway] use worker startup time out for worker registration (#13473)

This commit is contained in:
Simo Lin
2025-11-17 19:28:21 -08:00
committed by GitHub
parent 26ca07469b
commit 9188feccca
5 changed files with 12 additions and 11 deletions
@@ -74,7 +74,7 @@ class Router:
- PolicyType.PowerOfTwo: Select best of two random workers based on load (PD mode only)
host: Host address to bind the router server. Supports IPv4, IPv6 (e.g., ::, ::1), or 0.0.0.0 for all interfaces. Default: '0.0.0.0'
port: Port number to bind the router server. Default: 3001
worker_startup_timeout_secs: Timeout in seconds for worker startup. Default: 300
worker_startup_timeout_secs: Timeout in seconds for worker startup and registration. Large models can take significant time to load into GPU memory. Default: 1800 (30 minutes)
worker_startup_check_interval: Interval in seconds between checks for worker initialization. Default: 10
cache_threshold: Cache threshold (0.0-1.0) for cache-aware routing. Routes to cached worker
if the match rate exceeds threshold, otherwise routes to the worker with the smallest
@@ -26,7 +26,7 @@ class RouterArgs:
policy: str = "cache_aware"
prefill_policy: Optional[str] = None # Specific policy for prefill nodes in PD mode
decode_policy: Optional[str] = None # Specific policy for decode nodes in PD mode
worker_startup_timeout_secs: int = 600
worker_startup_timeout_secs: int = 1800
worker_startup_check_interval: int = 30
cache_threshold: float = 0.3
balance_abs_threshold: int = 64
@@ -209,7 +209,7 @@ class RouterArgs:
f"--{prefix}worker-startup-timeout-secs",
type=int,
default=RouterArgs.worker_startup_timeout_secs,
help="Timeout in seconds for worker startup",
help="Timeout in seconds for worker startup and registration (default: 1800 / 30 minutes). Large models can take significant time to load into GPU memory.",
)
parser.add_argument(
f"--{prefix}worker-startup-check-interval",
+4 -4
View File
@@ -467,9 +467,9 @@ impl Default for RouterConfig {
policy: PolicyConfig::Random,
host: "0.0.0.0".to_string(),
port: 3001,
max_payload_size: 536_870_912, // 512MB
request_timeout_secs: 1800, // 30 minutes
worker_startup_timeout_secs: 600,
max_payload_size: 536_870_912, // 512MB
request_timeout_secs: 1800, // 30 minutes
worker_startup_timeout_secs: 1800, // 30 minutes for large model loading
worker_startup_check_interval_secs: 30,
dp_aware: false,
api_key: None,
@@ -580,7 +580,7 @@ mod tests {
assert_eq!(config.port, 3001);
assert_eq!(config.max_payload_size, 536_870_912);
assert_eq!(config.request_timeout_secs, 1800);
assert_eq!(config.worker_startup_timeout_secs, 600);
assert_eq!(config.worker_startup_timeout_secs, 1800);
assert_eq!(config.worker_startup_check_interval_secs, 30);
assert!(config.discovery.is_none());
assert!(config.metrics.is_none());
@@ -898,10 +898,11 @@ impl StepExecutor for ActivateWorkerStep {
pub fn create_worker_registration_workflow(
router_config: &crate::config::RouterConfig,
) -> WorkflowDefinition {
// Use health check timeout from config with 30 second buffer as workflow-level upper bound
let detect_timeout = Duration::from_secs(router_config.health_check.timeout_secs + 30);
// Use startup timeout from config for worker registration
// This is separate from health_check.timeout_secs which is for individual HTTP requests
let detect_timeout = Duration::from_secs(router_config.worker_startup_timeout_secs);
// Calculate max_attempts to match the detect_timeout
// Calculate max_attempts to match the startup_timeout
// With Linear backoff (increment 1s, max 5s):
// - Attempts 1-5: 0s, 1s, 2s, 3s, 4s = 10s total
// - Attempts 6+: 5s each
+1 -1
View File
@@ -126,7 +126,7 @@ struct CliArgs {
#[arg(long, value_parser = ["random", "round_robin", "cache_aware", "power_of_two"])]
decode_policy: Option<String>,
#[arg(long, default_value_t = 600)]
#[arg(long, default_value_t = 1800)]
worker_startup_timeout_secs: u64,
#[arg(long, default_value_t = 30)]