Bug #66908 Perfomrance Metrics aren't logged at regular intervals
Submitted: 21 Sep 2012 13:15 Modified: 15 Dec 2012 0:20
Reporter: Tom Wieczorek Email Updates:
Status: Verified Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.21, 5.1.22 OS:Any
Assigned to: Alexander Soklakov
Triage: Needs Triage: D3 (Medium)

[21 Sep 2012 13:15] Tom Wieczorek
The Performance metrics (Configuration Property gatherPerfMetrics=true) aren't logged at regular intervals (Configuration Property reportMetricsIntervalMillis), but only when a connection is closed.

The method com.mysql.jdbc.ConnectionImpl.reportMetricsIfNeeded() isn't called anywhere in Connector/J. It used to be called in com.mysql.jdbc.ConnectionImpl.getMutex() in 5.0, but it seems that this method has been replaced by another mechanism.

How to repeat:
Connect to a database using Connector/J and use the following Configuration Properties:


Perform some queries, e.g. "SELECT NOW()" every sec or so.

Performance Metrics are only displayed when the connection is closed, but not every 2.5 secs.

Suggested fix:
Call com.mysql.jdbc.ConnectionImpl.reportMetricsIfNeeded() at a reasonable place.
[15 Dec 2012 0:20] Sveta Smirnova
Thank you for the report.

Verified as described. Even with reportMetricsIntervalMillis=5. Probably this is not very clear documentation.
[15 Dec 2012 0:21] Sveta Smirnova
test case for testsuite, add &gatherPerfMetrics=true&reportMetricsIntervalMillis=5 to connection properties

Attachment: bug66908.java (text/x-java), 1.07 KiB.