aws resource_error ai_generated true

FATAL: remaining connection slots are reserved for non-replication superuser connections (RDS Proxy)

ID: aws/rds-proxy-max-connections-exceeded

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-08-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
RDS Proxy (2023-03-15) active
PostgreSQL 13.12 active
MySQL 8.0.35 active

Root Cause

The RDS Proxy has exhausted its maximum connection pool size (default 100) due to too many concurrent connections from applications, and the database instance itself is also at its max_connections limit.

generic

中文

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

Official Documentation

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

Workarounds

  1. 90% success Increase the RDS Proxy's MaxConnectionsPercent and SessionPinningFilters in the proxy configuration via AWS Console or CLI: `aws rds modify-db-proxy --db-proxy-name my-proxy --max-connections-percent 120`. Also ensure the RDS instance's max_connections is at least 1.5x the proxy limit.
    Increase the RDS Proxy's MaxConnectionsPercent and SessionPinningFilters in the proxy configuration via AWS Console or CLI: `aws rds modify-db-proxy --db-proxy-name my-proxy --max-connections-percent 120`. Also ensure the RDS instance's max_connections is at least 1.5x the proxy limit.
  2. 85% success Implement connection pooling in the application using a library like HikariCP (Java) or pgBouncer (PostgreSQL) to reduce the number of concurrent connections to the proxy. Example: set `maximumPoolSize=10` in HikariCP config.
    Implement connection pooling in the application using a library like HikariCP (Java) or pgBouncer (PostgreSQL) to reduce the number of concurrent connections to the proxy. Example: set `maximumPoolSize=10` in HikariCP config.
  3. 80% success Monitor active connections using CloudWatch metrics for RDS Proxy (e.g., 'DatabaseConnections') and scale the DB instance to a larger size if needed.
    Monitor active connections using CloudWatch metrics for RDS Proxy (e.g., 'DatabaseConnections') and scale the DB instance to a larger size if needed.

中文步骤

  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')监控活动连接,并在需要时将数据库实例扩展到更大的尺寸。

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Increasing only the RDS instance's max_connections without adjusting RDS Proxy's MaxConnectionsPercent will still cause the proxy to reject connections.

  2. 75% fail

    Restarting the RDS Proxy without scaling the instance or reducing application connections will result in the same error immediately after restart.

  3. 35% fail

    Assuming the error is a database authentication issue and resetting credentials, which does not address the connection limit.