From 202ec21babe4daa7b3dac983d64bcea6ae1c3bca Mon Sep 17 00:00:00 2001 From: yangjianbo Date: Mon, 12 Jan 2026 14:26:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E6=8F=90=E5=8D=87=E7=B2=98?= =?UTF-8?q?=E6=80=A7=E4=BC=9A=E8=AF=9D=E9=BB=98=E8=AE=A4=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 默认值调整为 120s - 同步示例配置与环境变量 --- backend/internal/config/config.go | 2 +- deploy/.env.example | 12 ++++++++++++ deploy/config.example.yaml | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go index 5aac1a23..944e0f84 100644 --- a/backend/internal/config/config.go +++ b/backend/internal/config/config.go @@ -767,7 +767,7 @@ func setDefaults() { viper.SetDefault("gateway.stream_keepalive_interval", 10) viper.SetDefault("gateway.max_line_size", 10*1024*1024) viper.SetDefault("gateway.scheduling.sticky_session_max_waiting", 3) - viper.SetDefault("gateway.scheduling.sticky_session_wait_timeout", 45*time.Second) + viper.SetDefault("gateway.scheduling.sticky_session_wait_timeout", 120*time.Second) viper.SetDefault("gateway.scheduling.fallback_wait_timeout", 30*time.Second) viper.SetDefault("gateway.scheduling.fallback_max_waiting", 100) viper.SetDefault("gateway.scheduling.load_batch_enabled", true) diff --git a/deploy/.env.example b/deploy/.env.example index abd94b02..e5cf8b32 100644 --- a/deploy/.env.example +++ b/deploy/.env.example @@ -73,6 +73,18 @@ JWT_EXPIRE_HOUR=24 # Gateway Scheduling (Optional) # 调度缓存与受控回源配置(缓存就绪且命中时不读 DB) # ----------------------------------------------------------------------------- +# 粘性会话最大排队长度 +GATEWAY_SCHEDULING_STICKY_SESSION_MAX_WAITING=3 +# 粘性会话等待超时(时间段,例如 45s) +GATEWAY_SCHEDULING_STICKY_SESSION_WAIT_TIMEOUT=120s +# 兜底排队等待超时(时间段,例如 30s) +GATEWAY_SCHEDULING_FALLBACK_WAIT_TIMEOUT=30s +# 兜底最大排队长度 +GATEWAY_SCHEDULING_FALLBACK_MAX_WAITING=100 +# 启用调度批量负载计算 +GATEWAY_SCHEDULING_LOAD_BATCH_ENABLED=true +# 并发槽位清理周期(时间段,例如 30s) +GATEWAY_SCHEDULING_SLOT_CLEANUP_INTERVAL=30s # 是否允许受控回源到 DB(默认 true,保持现有行为) GATEWAY_SCHEDULING_DB_FALLBACK_ENABLED=true # 受控回源超时(秒),0 表示不额外收紧超时 diff --git a/deploy/config.example.yaml b/deploy/config.example.yaml index e1b21f5b..ce2439f4 100644 --- a/deploy/config.example.yaml +++ b/deploy/config.example.yaml @@ -172,6 +172,24 @@ gateway: # Scheduling configuration # 调度配置 scheduling: + # Sticky session max waiting queue size + # 粘性会话最大排队长度 + sticky_session_max_waiting: 3 + # Sticky session wait timeout (duration) + # 粘性会话等待超时(时间段) + sticky_session_wait_timeout: 120s + # Fallback wait timeout (duration) + # 兜底排队等待超时(时间段) + fallback_wait_timeout: 30s + # Fallback max waiting queue size + # 兜底最大排队长度 + fallback_max_waiting: 100 + # Enable batch load calculation for scheduling + # 启用调度批量负载计算 + load_batch_enabled: true + # Slot cleanup interval (duration) + # 并发槽位清理周期(时间段) + slot_cleanup_interval: 30s # 是否允许受控回源到 DB(默认 true,保持现有行为) db_fallback_enabled: true # 受控回源超时(秒),0 表示不额外收紧超时