并发模型从「每worker并发1 + 多worker并行」改为全局串行:同一时间 只处理1个请求,其余排队;多 worker 仅作热备(主 worker 坏了才用备机)。 接口4(face/features) 走豆包、不占 GPU,不纳入串行。 - pool: asyncio.Semaphore(max_global_concurrency=1) + acquire/release_global_slot (依赖单进程 uvicorn 部署,已在注释中标注) - forward: proxy_request 最外层 acquire 全局槽、try/finally 全路径释放; 入参 multipart 解析挂 request.state;原重试/故障转移逻辑抽到 _dispatch_with_retries - reqlog(新): 标量入参保留;图片(file/base64)存盘转URL,绝不内嵌base64; 出参递归摘要截断(landmarks/长串/大数组) - logging_middleware: RequestLogEntry 加 request_params/response_data, jsonl 全量记录;_load_from_logfile 同步映射防重启丢字段;get_stats recent 暴露 - /gateway-health 暴露 global_max/global_busy/global_waiting - config: dispatch 新增 max_global_concurrency / max_queue_wait_seconds - tests: test_reqlog + test_gateway_serialization(9 用例) 顺带提交此前未提交的网关统计(daily stats 接口)与耗时看板(api_timing_dashboard.html)。 Co-Authored-By: Claude <noreply@anthropic.com>
31 lines
718 B
JSON
31 lines
718 B
JSON
{
|
|
"workers": [
|
|
"http://127.0.0.1:28187",
|
|
"http://127.0.0.1:28188"
|
|
],
|
|
"shared_password": "REPLACE_ME_ROTATE_PERIODICALLY",
|
|
"public_base_url": "https://hair.xiangsilian.com",
|
|
"static_dir": "static/annotations",
|
|
"health_check": {
|
|
"path": "/health",
|
|
"interval_seconds": 8,
|
|
"timeout_seconds": 3,
|
|
"unhealthy_threshold": 2,
|
|
"healthy_threshold": 1
|
|
},
|
|
"ark_api_key": "",
|
|
"dispatch": {
|
|
"per_worker_concurrency": 1,
|
|
"max_global_concurrency": 1,
|
|
"max_queue_wait_seconds": 590,
|
|
"queue_wait_seconds": 30,
|
|
"request_timeout_seconds": 600,
|
|
"retry_on_failure": true,
|
|
"max_retries": 1
|
|
},
|
|
"cleanup": {
|
|
"interval_minutes": 60,
|
|
"max_age_hours": 24
|
|
}
|
|
}
|