Skip to content

Problem with HikariCP connection handling when using AWS RDS Proxy #2349

@krushna-02

Description

@krushna-02

Current setup

  • Application: Spring Boot 3.3.0
  • Java: 21
  • Connection Pool: HikariCP 5.1.0
  • Database: Aurora MySQL 8
  • RDS Proxy: Enabled (with default pool settings)

Steps to reproduce

  1. Configure Spring Boot application with HikariCP pointing to Aurora MySQL through AWS RDS Proxy.
  2. Run application under normal traffic.
  3. Observe connection count at the database level.
  • Before enabling RDS Proxy (normal traffic): ~18–20 connections
  • After enabling RDS Proxy (same traffic): ~60–65 connections (close to the per-user max of 65 in RDS)

Connections continue to grow (2x–3x higher than before proxy), even when traffic remains stable.


Expected behavior

HikariCP should reuse connections efficiently through RDS Proxy without exceeding configured pool limits.


Actual behavior

  • Connections are not being reused as expected.
  • Over time, HikariCP hits the max connection limits, leading to errors such as:
    • Too many connections
    • Max connections reached
  • Observed that connections accumulate on the RDS side and are not released properly.

Error messages / Logs

Examples (seen intermittently under load):

  • com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
  • Too many connections

HikariCP Configs

datasource.url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB}?useUnicode=yes&characterEncoding=UTF-8&charSet=UTF-8&useSSL=false&tcpKeepAlive=true&cachePrepStmts=false
datasource.connection-timeout=30000
datasource.idle-timeout=1200000     # 20 mins
datasource.max-lifetime=1740000     # 29 mins
datasource.maximum-pool-size=5
datasource.minimum-idle=3
datasource.leak-detection-threshold=15000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions