feat(worker): 实现集群限流与自适应负载
保留平台模型 RPM、TPM 和并发策略语义,增加 PostgreSQL 集群级租约、饱和候选重选和多平台自动负载,避免突发任务固定等待首个平台。\n\n新增 Worker 实时负载采样、自适应 active/heavy 容量、心跳与管理端指标,并扩展本地 acceptance runner,覆盖三 Worker、同模型三平台 2/4/6 并发和 48 个带图视频突发任务。\n\n验证:go test ./...、go vet ./...、PostgreSQL 跨 Store 集成测试、gofmt、bash -n、ShellCheck 及本地集群 provider-burst 验收通过;48/48 成功,无越限、重复提交、重复计费、重复回调或终态资源泄漏。
This commit is contained in:
@@ -2575,6 +2575,30 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/runtime/workers": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"acceptance"
|
||||
],
|
||||
"summary": "获取集群 Worker 实时负载与领取容量",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/store.WorkerClusterRuntime"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/system/acceptance/capacity-profiles": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -16347,6 +16371,108 @@
|
||||
"$ref": "#/definitions/store.GatewayWalletAccount"
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.WorkerClusterRuntime": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"capturedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"queue": {
|
||||
"$ref": "#/definitions/store.WorkerQueueRuntime"
|
||||
},
|
||||
"workers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/store.WorkerInstanceRuntime"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.WorkerInstanceRuntime": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activeLeases": {
|
||||
"type": "integer"
|
||||
},
|
||||
"allocatedCapacity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"capacityLimit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"drainingAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"finalizingTasks": {
|
||||
"type": "integer"
|
||||
},
|
||||
"hardCapacityLimit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"heartbeatAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"heavyCapacity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"instanceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"loadSampledAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"podName": {
|
||||
"type": "string"
|
||||
},
|
||||
"podUid": {
|
||||
"type": "string"
|
||||
},
|
||||
"preparingTasks": {
|
||||
"type": "integer"
|
||||
},
|
||||
"pressureReason": {
|
||||
"type": "string"
|
||||
},
|
||||
"pressureState": {
|
||||
"type": "string"
|
||||
},
|
||||
"reportedActiveTasks": {
|
||||
"type": "integer"
|
||||
},
|
||||
"revision": {
|
||||
"type": "string"
|
||||
},
|
||||
"runningTasks": {
|
||||
"type": "integer"
|
||||
},
|
||||
"safeCapacity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"site": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"waitingUpstreamTasks": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"store.WorkerQueueRuntime": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"oldestWaitSeconds": {
|
||||
"type": "number"
|
||||
},
|
||||
"queued": {
|
||||
"type": "integer"
|
||||
},
|
||||
"running": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
||||
Reference in New Issue
Block a user