From: | Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com> |
---|---|
To: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Could pgsql jdbc support pool reauthentication? |
Date: | 2017-10-31 09:20:14 |
Message-ID: | CAB=Je-F1rFGM+-DFHgGWdBxQ_R3=Ptqf9iUyEBndE3pDiYGyaA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Achilleas>I know, but we still risk having our max_connections exceeded.
You should limit the work at thread pool level, not at connection pool
level.
That is you should not accept new tasks for execution if they might block
on a "getConnection" call.
Imagine a case:
1) Thread A starts a transaction, it calls the DB
2) Thread B starts processing another request, it locks some Java lock and
calls .getConnection. Unfortunately, there's not enough connections, sot it
just waits.
3) Thread A completes the DB call, it continues and tries to take the same
Java lock.
Now we have a deadlock: A is waiting for the Java lock and it holds a DB
connection (with uncommitted transaction), while B is holding a Java lock
and it is trying to get a connection.
That is, it is not connection pool's task to limit the number of concurrent
requests.
Achilleas>And this is not scaleable.
Can you elaborate?
Vladimir
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2017-10-31 10:51:18 | Re: Could pgsql jdbc support pool reauthentication? |
Previous Message | Achilleas Mantzios | 2017-10-31 09:08:10 | Re: Could pgsql jdbc support pool reauthentication? |