Database Connections Lifetime

Questions about YourKit Java Profiler
Post Reply
RickRoberts
Posts: 2
Joined: Thu Sep 18, 2014 7:19 pm

Database Connections Lifetime

Post by RickRoberts »

Can someone help me understand the Performance Chart for:
Database Connections - Lifetime of Remaining Opened
Database Connections - Lifetime of Closed

Lifetime of Remaining Opened:
For my current application the "max lifetime" line is a straight line that continues to trend upward and never comes down.
The "average lifetime" trends upward for a while but then periodically drops down and then begins another upward trend.
( I wish I could send a screenshot ).

Lifetime of Closed:
This chart shows a straight line across the bottom of the graph with an occasional spike.

Also, is there some documentation somewhere that describes how to use these charts to tell if I have a healthy application or not?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Database Connections Lifetime

Post by Anton Katilin »

Hi,

Life time is the time passed since connection was opened and until it was closed or, if not closed yet, current point in time.
Lifetime of Remaining Opened:
This chart presents life time of connections which have not been closed by the end of the sample, i.e. those which "survived" the corresponding time point in the chart.
You may use this chart to estimate for how long connections stay unclosed. Please hover the chart with mouse pointer to see the oldest surviving connection detail, if available.
For my current application the "max lifetime" line is a straight line that continues to trend upward and never comes down.
I can't tell whether your application is healthy or not basing on your observations because this depends on your application logic. If you see ever growing "max lifetime" this means there is at least one connection opened long ago and never closed. This may be OK if you know that there is a connection opened once on start and then used during entire application runtime, and not OK if you expect all connections are short living.
The "average lifetime" trends upward for a while but then periodically drops down and then begins another upward trend.
This likely means that connections are created with some constant (or near to) rate, and then several connections close at once. For example, this may be caused by not closing connections immediately after use, but later in finalize as a result of garbage collection.

You may check for GC activity in the time points when they drop. See corresponding chart under Basic Telemetry node.

Please also check the Database Connections - Open/close chart. If open and close counts stay balanced in time your application is likely OK. If the number of remaining (i.e. opened minus closed) connections constantly grows, or grows then suddenly drops, there may be a resource leak.
Lifetime of Closed:
This chart shows a straight line across the bottom of the graph with an occasional spike.
Presents connections closed in time interval between telemetry samples. Hover the chart with mouse pointer to highlight the interval and see detail, if available.

Please note that Performance charts provide limited statistics only. To see full detail use Events:
http://www.yourkit.com/docs/java/help/probes_ui.jsp

Best regards,
Anton
RickRoberts
Posts: 2
Joined: Thu Sep 18, 2014 7:19 pm

Re: Database Connections Lifetime

Post by RickRoberts »

Thank you very much for your detailed reply.
Post Reply