# 致命错误：剩余的连接槽位保留给非复制超级用户连接（RDS Proxy）

- **ID:** `aws/rds-proxy-max-connections-exceeded`
- **领域:** aws
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

RDS Proxy 已耗尽最大连接池大小（默认 100），原因是来自应用程序的并发连接过多，并且数据库实例本身也达到了 max_connections 限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| RDS Proxy (2023-03-15) | active | — | — |
| PostgreSQL 13.12 | active | — | — |
| MySQL 8.0.35 | active | — | — |

## 解决方案

1. ```
   通过 AWS 控制台或 CLI 增加 RDS Proxy 的 MaxConnectionsPercent 和 SessionPinningFilters：`aws rds modify-db-proxy --db-proxy-name my-proxy --max-connections-percent 120`。同时确保 RDS 实例的 max_connections 至少是代理限制的 1.5 倍。
   ```
2. ```
   在应用程序中使用连接池库（如 Java 的 HikariCP 或 PostgreSQL 的 pgBouncer）来减少对代理的并发连接数。例如：在 HikariCP 配置中设置 `maximumPoolSize=10`。
   ```
3. ```
   使用 RDS Proxy 的 CloudWatch 指标（例如 'DatabaseConnections'）监控活动连接，并在需要时将数据库实例扩展到更大的尺寸。
   ```

## 无效尝试

- **** — Increasing only the RDS instance's max_connections without adjusting RDS Proxy's MaxConnectionsPercent will still cause the proxy to reject connections. (60% 失败率)
- **** — Restarting the RDS Proxy without scaling the instance or reducing application connections will result in the same error immediately after restart. (75% 失败率)
- **** — Assuming the error is a database authentication issue and resetting credentials, which does not address the connection limit. (35% 失败率)
