feat: tune websocket hub backpressure
This commit is contained in:
@@ -13,16 +13,20 @@ import (
|
||||
// RuntimeConfig 是节点启动后实际生效的后台控制参数。
|
||||
// 它只用于固定基数观测,不参与业务授权或持久化状态判断。
|
||||
type RuntimeConfig struct {
|
||||
WorkflowTickInterval time.Duration
|
||||
ScheduleTickInterval time.Duration
|
||||
RecoveryTickInterval time.Duration
|
||||
BatchLimit int
|
||||
ShutdownTimeout time.Duration
|
||||
WorkflowTickInterval time.Duration
|
||||
ScheduleTickInterval time.Duration
|
||||
RecoveryTickInterval time.Duration
|
||||
BatchLimit int
|
||||
ShutdownTimeout time.Duration
|
||||
WorkerConnectionLimit int // Worker WebSocket 单节点连接上限。
|
||||
EventConnectionLimit int // Event WebSocket 单节点连接上限。
|
||||
DispatchWorkers int // 每个 Hub 同时执行数据库领取调用的协程上限。
|
||||
DispatchCapacity int // 每个 Hub 领取调用的有界内存排队槽位。
|
||||
}
|
||||
|
||||
// RecordRuntimeConfig records the effective bounded controller settings.
|
||||
func (r *Registry) RecordRuntimeConfig(config RuntimeConfig) {
|
||||
if r == nil || config.WorkflowTickInterval <= 0 || config.ScheduleTickInterval <= 0 || config.RecoveryTickInterval <= 0 || config.BatchLimit <= 0 || config.ShutdownTimeout <= 0 {
|
||||
if r == nil || config.WorkflowTickInterval <= 0 || config.ScheduleTickInterval <= 0 || config.RecoveryTickInterval <= 0 || config.BatchLimit <= 0 || config.ShutdownTimeout <= 0 || config.WorkerConnectionLimit <= 0 || config.EventConnectionLimit <= 0 || config.DispatchWorkers <= 0 || config.DispatchCapacity <= 0 {
|
||||
return
|
||||
}
|
||||
r.SetGauge("orbit_runtime_tick_interval_seconds", config.WorkflowTickInterval.Seconds(), Labels{"component": "workflow"})
|
||||
@@ -30,6 +34,10 @@ func (r *Registry) RecordRuntimeConfig(config RuntimeConfig) {
|
||||
r.SetGauge("orbit_runtime_tick_interval_seconds", config.RecoveryTickInterval.Seconds(), Labels{"component": "execution_recovery"})
|
||||
r.SetGauge("orbit_runtime_batch_limit", float64(config.BatchLimit), nil)
|
||||
r.SetGauge("orbit_shutdown_timeout_seconds", config.ShutdownTimeout.Seconds(), nil)
|
||||
r.SetGauge("orbit_worker_connection_limit", float64(config.WorkerConnectionLimit), nil)
|
||||
r.SetGauge("orbit_event_connection_limit", float64(config.EventConnectionLimit), nil)
|
||||
r.SetGauge("orbit_dispatch_workers", float64(config.DispatchWorkers), nil)
|
||||
r.SetGauge("orbit_dispatch_capacity", float64(config.DispatchCapacity), nil)
|
||||
}
|
||||
|
||||
// RecordDraining records whether this process has entered graceful shutdown.
|
||||
|
||||
Reference in New Issue
Block a user