Re: Pgbouncer and Node JS application Query read timeout error
| От | Laurenz Albe |
|---|---|
| Тема | Re: Pgbouncer and Node JS application Query read timeout error |
| Дата | |
| Msg-id | 2bdca9488627c8a0e855f00d7a1137cfdd01746e.camel@cybertec.at обсуждение |
| Ответ на | Re: Pgbouncer and Node JS application Query read timeout error (KK CHN <kkchn.in@gmail.com>) |
| Список | pgsql-general |
On Fri, 2026-04-10 at 12:37 +0530, KK CHN wrote: > > 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. > > Configuring Node.js pools smaller ? I couldn't get the logic here why advised to reduce the pool size ? > > Increasing pool size more than 10 adversely affects the connection establishment from > Node.js application ? Since DB is having Pgbouncer infront and > default_pool_size = 50 there , don't we have the freedom to increase node.js application > pool size and it will help the query timeout ? or any hidden facts involved could you elaborate .. There are no hidden facts. You asked if pgBouncer could lead to query timeouts. I answered that the only way a query could take significantly longer with pgBouncer is if the client has to wait for a pooled connections, that is, if the connection pool in pgBouncer is smaller than the number of clients that want to run a transaction concurrently. BEFORE you take any action, you should figure out if that is the case by looking at SHOW POOLS. Since you didn't report any findings, I assume that you launched your volley of questions before doing the required investigation. Bad idea. IF (and only if) there are indeed client sessions waiting for a pooled connection, you could react in two different ways: - increase the pgBouncer pool size - reduce the application server pool size Obvious, isn't it? Increasing the pgBouncer pool size is a good idea only if your database machine can stomach the additional load. If not, reducing the application server pool size is the correct measure. If the application load is too much for the database, somebody has to suffer. If you choose to overload the database, everybody will be unhappy. If you throttle the load in the connection pool, only some client will be unhappy (those that have to wait and get a timeout). You will have to diagnose what the exact problem is. Yours, Laurenz Albe
В списке pgsql-general по дате отправления: