Re: Pgbouncer and Node JS application Query read timeout error

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: KK CHN <kkchn(dot)in(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Pgbouncer and Node JS application Query read timeout error
Date: 2026-04-08 06:27:59
Message-ID: 6b3cf69fa569d263a593cc2afe74dc35d29754eb.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2026-04-08 at 10:51 +0530, KK CHN wrote:
> List, I am using pgbouncer(PgBouncer 1.23.1 RHEL 9.4) along with  Postgres16(RHEL 9.4)
> for connection pooling.   
>
> Running a nodejs application which is throwing some errors  related to query timeout
> which the development team suspect after pgbouncer deployment this behaviour appears,
> but not sure 
>
> The error which is thrown from  the nodejs logs as follows.. 
>
> [image showing an error "Query read timeout"]
>
> Is this due to   pgbouncer config issues or   nodejs  pool config issues ?
>
> for  reference here the pgbouncer  config params and  node js  params at present.
>
> pgbouncer.ini
>
> [...]
> [pgbouncer]
> pool_mode = transaction
> default_pool_size = 50
> min_pool_size = 30
> reserve_pool_size = 10
> reserve_pool_timeout = 5
> max_db_connections = 130
> max_user_connections = 180
> server_lifetime = 3600
> server_idle_timeout = 600
> [...]

The only way I can imagine that pgBouncer is leading to timeouts on the client side
is if client sessions are waiting, because all connections are in use.

You can run SHOW POOLS in the pgBouncer console to see if there are any "cl_waiting".
If that is the case, you should configure the Node.js pools smaller, so that no
connection has to wait.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthias Apitz 2026-04-08 06:57:24 Re: configure && --with
Previous Message KK CHN 2026-04-08 05:21:32 Pgbouncer and Node JS application Query read timeout error