A JDBC driver wrapper and GUI to analyze statement performance
Measuring performance of SQL statements executed through JDBC.
(click on the image below for an overview of the features)
Although other tools already exist around JDBC performance monitoring (log4jdbc, P6Spy, JDbMonitor...), I did not find the features I was looking for : a GUI, measurement of statement execution and ResultSet iteration, cumulative measures, commit duration...
queryTimeout
of each statement (no value means 0 or no timeout) (since 0.5.0)autoCommit
status of each statement (since 0.6.0)executeLargeUpdate
(since 0.6.2)<dependency>
<groupId>com.github.sylvainlaurent.jdbcperflogger</groupId>
<artifactId>jdbc-perf-logger-agent</artifactId>
<version>...</version>
</dependency>
or
<dependency>
<groupId>com.github.sylvainlaurent.jdbcperflogger</groupId>
<artifactId>jdbc-perf-logger-driver</artifactId>
<version>...</version>
</dependency>
The driver can be setup in different ways:
Just launch the JVM with -javaagent:path/to/jdbc-perf-logger-agent-x.y.z.jar
The agent jar file is available in the lib
directory of the zip or tar.gz distribution or as a maven artifact as shown above.
<dependency>
snippet above (replacing the version with the latest one) to your pom.xml
jdbc-perf-logger-driver
jar file to the classpath of the JDBC-client application (the file can be found in the lib
directory of the binary distribution)ch.sla.jdbcperflogger.driver.WrappingDriver
jdbcperflogger:
, example: jdbcperflogger:jdbc:h2:mem:
or jdbcperflogger:jdbc:oracle:thin:@myhost:1521:orcl
jdbcperflogger.xml
file to the classpath (see the example file for indications). If both the driver and console are used on the same machine, there's nothing to do: the driver will try to connect to the console on localhost:4561.jdbcperflogger.config.location
. Example : java -Djdbcperflogger.config.location=/Users/me/myjdbcperflogger.xml ....
bin/jdbc-performance-logger-gui.sh
(unix/MacOS) or bin\jdbc-performance-logger-gui.bat
(requires java 8 JRE)maxLoggedStatements
when launching the console.Statement.getMoreResults()
works but no effort has been put to log the fetching of those ResultSets)There should not be any problem when using the "java agent way".
For the "driver way", here are the rules to observe :
Here are the most common cases with Tomcat :
lib
directory of CATALINA_BASE
or CATALINA_HOME
.
This can also be done by configuring the catalina.properties
file.The source code is available on GitHub : https://github.com/sylvainlaurent/JDBC-Performance-Logger
Use Maven and a JDK >=8, and run mvn clean verify
in the root directory of the git repository. The binary distribution is then available in jdbc-perf-logger-gui
.
mvn release:prepare release:perform
and answer the questions about version number.
Then push the commits and tags to github.
This software is licensed under the Apache Sotware License version 2.0, see LICENSE.txt.
This software uses and redistributes third-party software, see 3rdparty_license.txt.