[feature] [sgl-router] Add a dp-aware routing strategy (#6869)
This commit is contained in:
@@ -21,6 +21,10 @@ pub struct RouterConfig {
|
||||
pub worker_startup_timeout_secs: u64,
|
||||
/// Worker health check interval in seconds
|
||||
pub worker_startup_check_interval_secs: u64,
|
||||
/// Enable data parallelism aware schedule
|
||||
pub dp_aware: bool,
|
||||
/// The api key used for the authorization with the worker
|
||||
pub api_key: Option<String>,
|
||||
/// Service discovery configuration (optional)
|
||||
pub discovery: Option<DiscoveryConfig>,
|
||||
/// Metrics configuration (optional)
|
||||
@@ -205,6 +209,8 @@ impl Default for RouterConfig {
|
||||
request_timeout_secs: 600,
|
||||
worker_startup_timeout_secs: 300,
|
||||
worker_startup_check_interval_secs: 10,
|
||||
dp_aware: false,
|
||||
api_key: None,
|
||||
discovery: None,
|
||||
metrics: None,
|
||||
log_dir: None,
|
||||
@@ -311,6 +317,8 @@ mod tests {
|
||||
request_timeout_secs: 30,
|
||||
worker_startup_timeout_secs: 60,
|
||||
worker_startup_check_interval_secs: 5,
|
||||
dp_aware: false,
|
||||
api_key: None,
|
||||
discovery: Some(DiscoveryConfig::default()),
|
||||
metrics: Some(MetricsConfig::default()),
|
||||
log_dir: Some("/var/log".to_string()),
|
||||
@@ -727,6 +735,8 @@ mod tests {
|
||||
request_timeout_secs: 120,
|
||||
worker_startup_timeout_secs: 60,
|
||||
worker_startup_check_interval_secs: 5,
|
||||
dp_aware: false,
|
||||
api_key: None,
|
||||
discovery: Some(DiscoveryConfig {
|
||||
enabled: true,
|
||||
namespace: Some("sglang".to_string()),
|
||||
@@ -774,6 +784,8 @@ mod tests {
|
||||
request_timeout_secs: 300,
|
||||
worker_startup_timeout_secs: 180,
|
||||
worker_startup_check_interval_secs: 15,
|
||||
dp_aware: false,
|
||||
api_key: None,
|
||||
discovery: Some(DiscoveryConfig {
|
||||
enabled: true,
|
||||
namespace: None,
|
||||
@@ -812,6 +824,8 @@ mod tests {
|
||||
request_timeout_secs: 900,
|
||||
worker_startup_timeout_secs: 600,
|
||||
worker_startup_check_interval_secs: 20,
|
||||
dp_aware: false,
|
||||
api_key: None,
|
||||
discovery: Some(DiscoveryConfig {
|
||||
enabled: true,
|
||||
namespace: Some("production".to_string()),
|
||||
|
||||
@@ -313,6 +313,14 @@ impl ConfigValidator {
|
||||
}
|
||||
}
|
||||
|
||||
// Service discovery is conflict with dp_aware routing for now
|
||||
// since it's not fully supported yet
|
||||
if has_service_discovery && config.dp_aware {
|
||||
return Err(ConfigError::IncompatibleConfig {
|
||||
reason: "DP-aware routing is not compatible with service discovery".to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user