fix(gateway): 优化网关连接池和服务端保活配置

- 配置网关HttpClient连接池max-idle-time为30s,确保小于下游服务keep-alive-timeout
- 设置网关连接超时时间为10s,响应超时时间为30s
- 配置下游服务tomcat keep-alive-timeout为60s,避免与网关连接池形成竞争条件
- 将灰度负载均衡器日志级别从warn调整为debug,减少本地开发环境日志噪音
- 添加系统性调试技能配置到Claude设置中
This commit is contained in:
2026-05-18 08:28:33 +08:00
parent bd05f6d593
commit 50b84a57bb
5 changed files with 25 additions and 3 deletions

View File

@@ -30,6 +30,15 @@ spring:
gateway:
server:
webflux:
# HttpClient 连接池配置:网关作为反向代理客户端,复用到下游服务的 keep-alive 连接。
# 必须保证 max-idle-time < 下游 server.tomcat.keep-alive-timeout当前下游为 60s
# 否则服务端先 FIN、网关池仍持有"已死连接",复用时会抛 reactor.netty.http.client.PrematureCloseException。
httpclient:
connect-timeout: 10000 # 建立连接超时,毫秒
response-timeout: 30s # 接收响应超时
pool:
max-idle-time: 30s # 闲置连接最长保留 30s严格小于下游 keep-alive-timeout(60s)
evict-in-background: 60s # 周期后台驱逐过期连接,进一步降低 race 概率
# 路由配置项,对应 RouteDefinition 数组
routes:
## system-server 服务