Reputation: 1666
I am creating a lag of 1.5 sec with chaos monkey to simulate a network delay. The test has 100 parallel users continuously calling an end-point which requires Database access.
During the testing I see a lot of InterruptedException
from Tomcat Jdbc version 8.5.
The stack trace is as following:
"Caused by: java.lang.InterruptedException",
"\tat java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1039)",
"\tat java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)",
"\tat java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277)",
"\tat org.apache.tomcat.jdbc.pool.FairBlockingQueue.poll(FairBlockingQueue.java:157)",
"\tat org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:707)",
It seems that during the wait for borrowing the connection, Tomcat Jdbc or some thread is interrupting the thread.
Our configuration is as following:
defaultAutoCommit=true
initialSize=2
maxActive=8
maxIdle=4
minIdle=2
maxWait=60000
testOnReturn=false
testOnBorrow=true
timeBetweenEvictionRunsMillis=10000
minEvictableIdleTimeMillis=30000
logAbandoned=true
Notably when I change the testOnBorrow
to false, these exceptions go off.
Further to get more details, I started logging the activeThreads, idleThreads, waitingThreads and time spent to get the connection.
The logged data looks too cryptic to me to understand anything. But here is the key observation:
I never see time spent to get the connection more than 40 seconds. Though the maxWait is 60 seconds. Ideally in case of failure the thread should spend 60 seconds waiting.
Many a times I see that activeThreads are 1 or 0, idleThreads are again 1 or 2 and waitingThreads are 75 or so...and after sometime the waitingThreads becomes 0.
Upvotes: 1
Views: 174