I'm using HikariCP, Java 11, Postgres. When one of the DBs goes down for some reason, all the queries to the db fail after N seconds (which is the HikariCP's checkoutTimeout). It leads to the problem when a calling thread is waiting for N seconds even when we can already know that the db is down (because it has not been answering for some time). Are there any mechanisms to have a smarter behavior?
Asked
Active
Viewed 99 times
0
-
That sounds like you need a load balancer. – Laurenz Albe Sep 02 '21 at 06:39
-
could you please clarify it, we have PGBouncer on the Postgres side. It works well for us. But the problem is on the application side which uses HikariCP pool (postgres client). After several failed SQL queries it can not understand that there is no need to wait for N seconds to get the connection brcause the DB is most likely broken – Aleksandr Kiruyshkin Sep 02 '21 at 07:28
-
See https://stackoverflow.com/questions/57756239/not-able-to-open-connection-from-pgbouncer-connection-attempt-timed-out/57756405#57756405 – Ori Marko Sep 02 '21 at 08:12