Closed jikegreen closed 2 years ago
What is outcome please. Facing same symptoms at our side.
it helps to set poolsize to a big value (which is not advisable but easy to do, so there is always a connection available) or change your database to use a queue so not to many connections are used together, avoiding deadlock
@jikegreen First, don't use connection-test-query
for MySQL, it supports JDBC4 Connection.isValid(). Second, this looks like nothing more than an application design issue.
Rather than spinning up ~200 threads, queue up work in a thread pool with maximum 15 threads (matching your maxConnections=15
). For example, a ThreadPoolExecutor
with 15 threads. You will avoid the timeouts waiting for connections, and will smooth out spike loads.
var tpe = new ThreadPoolExecutor(1/*core*/, 15/*max*/, 10/*keepalive*/, TimeUnit.SECONDS, new LinkedBlockingQueue(512));
tpe.allowCoreThreadTimeOut(true);
Environment
The pool config
Server App
MQ App
Stack in Server App
Hi,brett: I meet some performance problem of HikariCP under pressure, In Server App,lots of threads pending at HikariCP's borrow method to wait for a connection, and with the image above,I find that most threads pending at connection's acquisition time. In Mq App,It works fine,I find the consumer only use 2 threads to consume message,so i config the pool 2 connections.
Any ideas?