From 9448e1a300abd227d8bbae58c3ad5ddb80052691 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Thu, 27 Mar 2014 10:00:48 +0900 Subject: [PATCH 01/10] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3ab66dfc..702d5327 100644 --- a/README.md +++ b/README.md @@ -126,12 +126,12 @@ preferred if supported by the JDBC driver. *Default: true* :abc:``jdbcUrl``
This property is only used when the ``driverClassName`` property is used to wrap an old-school JDBC driver as a ``javax.sql.DataSource``. While JBDC URLs are popular, HikariCP does not -recommend using them. The *DataSource* implementation for your driver provides bean properties -for all the driver parameters that used to be specified in the JDBC URL. Before using the ``jdbcUrl`` -and ``driverClassName`` because that's the way you've always done it, consider using the more -modern and maintainable ``dataSourceClassName`` approach instead. Note that if this property -is used, you may still use *DataSource* properties to configure your driver and is in fact -recommended. *Default: none* +recommend using them. The *DataSource* implementation provided by your driver provides bean +properties for all the driver parameters that used to be specified in the JDBC URL. Before using +the ``jdbcUrl`` and ``driverClassName`` because that's the way you've always done it, consider +using the more modern and maintainable ``dataSourceClassName`` approach instead. Note that if +this property is used, you may still use *DataSource* properties to configure your driver and +is in fact recommended. *Default: none* :watch:``leakDetectionThreshold``
This property controls the amount of time that a connection can be out of the pool before a From 501e5d28a7e4f3024728097bda00811168da3a9b Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Thu, 27 Mar 2014 16:31:58 +0900 Subject: [PATCH 02/10] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 702d5327..ae56b548 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ Using the excellent [JMH microbenchmark framework](http://openjdk.java.net/proje Not all pools are created equal. Read our [pool analysis](https://github.com/brettwooldridge/HikariCP/wiki/Pool-Analysis) here if you care to know the good, bad, and ugly. +#### You're [probably] doing it wrong +AKA ["What you probably didn't know about connection pool sizing"](https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing). Read on to find out. + ------------------------------ #### Configuration (knobs, baby!) From 80601478cf2d2dbf16335130067aedf9e1992173 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Thu, 27 Mar 2014 17:18:19 +0900 Subject: [PATCH 03/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae56b548..d3302439 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ Using the excellent [JMH microbenchmark framework](http://openjdk.java.net/proje 2 Tomcat fails to complete *Statement Cycle* benchmark when "StatementFinalizer" feature is enabled.
3 Benchmark results run against 1.3.3
-#### What's wrong with other pools? +#### What's up with other pools? Not all pools are created equal. Read our [pool analysis](https://github.com/brettwooldridge/HikariCP/wiki/Pool-Analysis) here if you care to know the good, bad, and ugly. -#### You're [probably] doing it wrong +#### You're [probably] doing it wrong. AKA ["What you probably didn't know about connection pool sizing"](https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing). Read on to find out. ------------------------------ From 9c058e7b3a5cd957c7375e8c9e3a00992add713d Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Thu, 27 Mar 2014 22:45:07 +0900 Subject: [PATCH 04/10] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3302439..1d356347 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ before timing out. *Default: 10* This property controls the minimum number of *idle connections* that HikariCP tries to maintain in the pool. If the idle connections dip below this value, HikariCP will make a best effort to add additional connections quickly and efficiently. However, for maximum performance and -responsiveness to spike demands, we recommend *not* setting this value and instead alloing +responsiveness to spike demands, we recommend *not* setting this value and instead allowing HikariCP to act as a *fixed size* connection pool. *Default: same as maximumPoolSize* :abc:``password``
From c7cc57317586955c72eb29ad0345db845e3d45ec Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 30 Mar 2014 10:50:04 +0900 Subject: [PATCH 05/10] [maven-release-plugin] prepare release HikariCP-1.3.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b069152b..8263f15a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.zaxxer HikariCP - 1.3.5-SNAPSHOT + 1.3.5 bundle HikariCP From 3fb742ae53ceac06bccc6c4fff59a2cfdb8bee97 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 30 Mar 2014 10:50:10 +0900 Subject: [PATCH 06/10] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8263f15a..60943968 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.zaxxer HikariCP - 1.3.5 + 1.3.6-SNAPSHOT bundle HikariCP From 2b6d7621cd6d99efc8faa5632b56055abd0fe5d5 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 30 Mar 2014 12:54:36 +0900 Subject: [PATCH 07/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d356347..6b61b600 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ There is nothing faster. There is nothing more correct. HikariCP is a "zero-ov com.zaxxer HikariCP - 1.3.4 + 1.3.5 compile ``` From 01bcaa320521afc08c248f0f47d467087d399986 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sun, 30 Mar 2014 21:29:11 -0700 Subject: [PATCH 08/10] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 6b61b600..f732a5f2 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,22 @@ ds.addDataSourceProperty("password", "51mp50n"); ``` The advantage of configuring via ``HikariConfig`` over ``HikariDataSource`` is that when using the ``HikariConfig`` we know at ``DataSource`` construction-time what the configuration is, so the pool can be initialized at that point. However, when using ``HikariDataSource`` alone, we don't know that you are *done* configuring the DataSource until ``getConnection()`` is called. In that case, ``getConnection()`` must perform an additional check to see if the pool has been initialized yet or not. The cost (albeit small) of this check is incurred on every invocation of ``getConnection()`` in that case. In summary, intialization by ``HikariConfig`` is ever so slightly more performant than initialization directly on the ``HikariDataSource`` -- not just at construction time but also at runtime. +### Popular DataSource Class Names +We recommended using ``dataSourceClassName`` instead of ``driverClassName``/``jdbcUrl``, as using the driver class requires HikariCP to wrap the driver with an internal *DataSource* class. Here is a list of JDBC *DataSource* classes for popular databases: + +| Database | Driver | *DataSource* class | +|:---------------- |:------------ |:-------------------| +| Apache Derby | Derby | org.apache.derby.jdbc.ClientDataSource | +| H2 | H2 | org.h2.jdbcx.JdbcDataSource | +| HSQLDB | HSQLDB | org.hsqldb.jdbc.JDBCDataSource | +| MariaDB & MySQL | MariaDB | org.mariadb.jdbc.MySQLDataSource | +| MySQL | Connector/J | com.mysql.jdbc.jdbc2.optional.MysqlDataSource | +| MS SQL Server | Microsoft | com.microsoft.sqlserver.jdbc.SQLServerDataSource | +| Oracle | Oracle | oracle.jdbc.pool.OracleDataSource | +| PostgreSQL | pgjdbc-ng | com.impossibl.postgres.jdbc.PGDataSource | +| PostgreSQL | PostgreSQL | org.postgresql.ds.PGSimpleDataSource | +| SyBase | jConnect | com.sybase.jdbcx.SybDataSource | + ### Play Framework Plugin Github user [autma](https://github.com/autma) has created a [plugin](https://github.com/autma/play-hikaricp-plugin) for the Play framework. Thanks! From dcba97c3cdebc4a9674d4509d06ae648d3f2bc59 Mon Sep 17 00:00:00 2001 From: Jared Stehler Date: Fri, 11 Apr 2014 13:27:48 -0400 Subject: [PATCH 09/10] log pool name in warn messages --- src/main/java/com/zaxxer/hikari/HikariPool.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/HikariPool.java b/src/main/java/com/zaxxer/hikari/HikariPool.java index 20bc3c3a..18850e0a 100644 --- a/src/main/java/com/zaxxer/hikari/HikariPool.java +++ b/src/main/java/com/zaxxer/hikari/HikariPool.java @@ -198,7 +198,8 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener } else { - LOGGER.debug("Connection returned to pool is broken, or the pool is shutting down. Closing connection."); + LOGGER.debug("Connection returned to pool {} is broken, or the pool is shutting down. Closing connection.", + configuration.getPoolName()); closeConnection(connectionProxy); } } @@ -357,7 +358,7 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener long now = System.currentTimeMillis(); if (now - lastConnectionFailureTime > 1000 || isDebug) { - LOGGER.warn("Connection attempt to database failed (not every attempt is logged): {}", e.getMessage(), (isDebug ? e : null)); + LOGGER.warn("Connection attempt to database {} failed (not every attempt is logged): {}", configuration.getPoolName(), e.getMessage(), (isDebug ? e : null)); } lastConnectionFailureTime = now; return false; From 9676c9291402477178163ed53c38d0262c4790f5 Mon Sep 17 00:00:00 2001 From: Jared Stehler Date: Mon, 14 Apr 2014 11:32:19 -0400 Subject: [PATCH 10/10] merged --- src/main/java/com/zaxxer/hikari/HikariPool.java | 2 +- src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/HikariPool.java b/src/main/java/com/zaxxer/hikari/HikariPool.java index 18850e0a..f1a41554 100644 --- a/src/main/java/com/zaxxer/hikari/HikariPool.java +++ b/src/main/java/com/zaxxer/hikari/HikariPool.java @@ -485,7 +485,7 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener { int total = totalConnections.get(); int idle = getIdleConnections(); - LOGGER.debug("{}Pool stats (total={}, inUse={}, avail={}, waiting={})", (prefix.length > 0 ? prefix[0] : ""), total, total - idle, idle, + LOGGER.debug("{}Pool stats {} (total={}, inUse={}, avail={}, waiting={})", (prefix.length > 0 ? prefix[0] : ""), configuration.getPoolName(), total, total - idle, idle, getThreadsAwaitingConnection()); } diff --git a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java index 75647341..dc5afec2 100644 --- a/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java +++ b/src/main/java/com/zaxxer/hikari/proxy/ConnectionProxy.java @@ -141,7 +141,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy forceClose |= sqlState.startsWith("08") | SQL_ERRORS.contains(sqlState); if (forceClose) { - LOGGER.warn("Connection {} marked as broken because of SQLSTATE({}), ErrorCode({}): {}", delegate.toString(), sqlState, sqle.getErrorCode(), sqle.getNextException()); + LOGGER.warn("Connection {} ({}) marked as broken because of SQLSTATE({}), ErrorCode({}): {}", delegate.toString(), parentPool.toString(), sqle.getErrorCode(), sqle.getNextException()); } else if (sqle.getNextException() instanceof SQLException) {