aws resource_error ai_generated true

FATAL:抱歉,客户端数量过多(RDS Proxy 连接限制已超出)

FATAL: sorry, too many clients already (RDS Proxy connection limit exceeded)

ID: aws/rds-proxy-connection-limit-exceeded

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2024-01-20首次发现

版本兼容性

版本状态引入弃用备注
RDS Proxy 1.0.0 active
PostgreSQL 13.7 active
MySQL 8.0.33 active

根因分析

RDS Proxy 已达到最大并发连接数限制,通常是由于连接泄漏或代理容量不足。

English

The RDS Proxy has reached its maximum concurrent connections limit, often due to connection leaks or insufficient proxy capacity.

generic

官方文档

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.html

解决方案

  1. 在代理设置中增加 RDS Proxy 的 MaxConnectionsPercent(控制台或使用 CLI 'aws rds modify-db-proxy --db-proxy-name myproxy --max-connections-percent 100')。这允许代理根据数据库实例的 max_connections 按比例处理更多连接。
  2. 修复应用程序中的连接泄漏:确保在所有代码路径中正确关闭数据库连接(例如,使用连接池,设置 'maxLifetime' 和 'idleTimeout')。使用像 HikariCP(Java)或 pgBouncer(PostgreSQL)这样的连接池库。

无效尝试

常见但无效的做法:

  1. 60% 失败

    Increasing the database instance max_connections without adjusting RDS Proxy's MaxConnectionsPercent parameter still leaves the proxy as the bottleneck.

  2. 40% 失败

    Restarting the RDS Proxy doesn't solve the underlying issue of connection leaks from the application; connections will quickly exhaust the limit again.