0

We have a java application that uses Postgres v11 along with PgBouncer for connection pooling. When we keep the application idle for 15 mins, the connection drops(JDBC). The database is hosted on Amazon AWS

The same is observed in Pgadmin.

We tried TCP keepalive and few others. Nothing works.

Any ideas?

Rawfodog
  • 13
  • 4

1 Answers1

0

Most connection pools have setting like "keep alive time", "keep alive query". You can set them in the Java application to prevent network timeout.

For example, for HikariCP:

  • keepaliveTime - "This property controls how frequently HikariCP will attempt to keep a connection alive, in order to prevent it from being timed out by the database or network infrastructure"

https://github.com/brettwooldridge/HikariCP#frequently-used

alexb
  • 453
  • 4
  • 11
  • I don't think `HikariCP` is needed. Because we already have `Pgbouncer` which already does the connection pooling, isn't it? – Rawfodog May 31 '21 at 06:52