How to enable HIKARI JNDI connection monitoring in glow root
We often get ourselves in a situation where we are not able to find the root cause of connection leak and connection timeout.
Below are some tips to monitor and tune JNDI HIKARI connection with Liferay.
Mostly we get two issues with HIKARI if database performance is not up to the mark.
connection is not available request timed out after ***** ms
lock wait timeout exceeded try restarting transaction
We need to analyze these points if there can’t be anything done from the Database side.
Increase pool size
Connection time increase
Check if there is any connection leak from code
Put proper connection configuration
Before doing the changes we need to enable connection monitoring in glowroot for the HIKARI as well.
To verify the problem is from database side we need to check the response time and slow traces
For example in the below scenario we can easily identify database query execution is eating up all the time not the JVM.
Click on slow traces
Select any one of the slowest transaction
We can clearly see the JDBC query is taking the most time.
Next we can do is enable HIKARIconnection monitoring
To enable these go to the configuration
Go to the gauge and click on add new, search for HIKARIand select the one you want to monitor and enable the above parameters.
But it will be only be available for selecting if we have added below configuration true in server.xml JNDI configuration
registermbean=true
You will be able to monitor the JNDI connection now and identify connection leaks and make your decisions according to the utilization.
To automatically remove abandoned connection from the pool:
removeAbandoned=”true”
To increase the pool size
maximumPoolSize=”50” (By default it is 10)
To set time for considering a connection as a leak connection, set leakDetectionThreshold property, removeAbandonedTimeout for removing the connection from pool after a certain time if it is idle for that much time.
After doing all these steps your connection is not available and the issue will be solved.