Hikaricp: Use alongside with PgPool/PgBouncer

Created on 13 Dec 2017  路  14Comments  路  Source: brettwooldridge/HikariCP

Hi All,

My use case is that I have one db instance accessed by many Scala apps and I want to have a connection pool between apps and instances of the app.

Each app is using hikariCp with a maxPool of 10 and I have ~10 apps using it. I have a PgPool in front but it doesn't seem to be reusing connection that much. It seems like each app instance is trying to maintain it's own pool alive all the time making PgPool useless.

How to deal with this use case?

Most helpful comment

Hey everybody,

I have the same question, is using HikariCP with PGBounder actually any good? Is the one a replacement to the other or can they be used together?
Thank you very much
George

All 14 comments

Did you find a solution ?

Hey @guizmaii. Not yet.

I believe making the connection short lived might be one solution to the problem but it kind of defeats the purpose of Hikari I believe

Consider PgPool as a Database instead of Connection Pooler.
Hikari is talking to PgPool thinking it as a DB not as a Connection pooler.
PgPool lends connection to clients similarly how PostgreSQL Server will do.

Hey everybody,

I have the same question, is using HikariCP with PGBounder actually any good? Is the one a replacement to the other or can they be used together?
Thank you very much
George

So our use case is that we have many instances of the same app, each instance have hikari but they all connect to a pgbouncer.

Seems to be able to improve a lot connections to the database compared with many instances of hikari

We have the same case, a lot of dockers with hikaricp and connect to pgbouncer. Is that optimal? We have 10 pool for eachinstance and 400 pool for pgbouncer.

But @grillorafael How do you stopped HikariCp from pooling DB connections in the app ?
Because if you are using both HikariCP in apps and pgbouncer as an external pooler than How the pooling is working since Hikari also caches connections and so do the pgbouncer !

I have the same question. Does anyone have any input?

Watching this thread! We have the same issue.

Anyone?

We are also using Hikari along with PGBouncer. Whenever our instance gets a request after remaining idle for some time, we are getting the following error.

Caused by: org.postgresql.util.PSQLException: Connection attempt timed out

Hi Guys,
Any news about this issue?

You might have better luck getting answers on stackoverflow, as this isn't strictly an issue with HikariCP. Since the HikariCP maintainers don't have much experience with PGBouncer, they can't really give much advice.

You don't need an application-level load balancer if you are using PgBouncer.
PgBouncer handles all connection pooling to the database.
If you use HikarciCP with PgBouncer you will just interfere with what PgBouncer does best.

Was this page helpful?
0 / 5 - 0 ratings