2.3.0
Brett Wooldridge 10 years ago
commit 949fcb2e43

@ -69,11 +69,11 @@ AKA ["What you probably didn't know about connection pool sizing"](https://githu
#### Configuration (knobs, baby!) #### Configuration (knobs, baby!)
HikariCP comes with *sane* defaults that perform well in most deployments without additional tweaking. **Every property is optional, except for the "essentials" marked below.** HikariCP comes with *sane* defaults that perform well in most deployments without additional tweaking. **Every property is optional, except for the "essentials" marked below.**
<sup>:paperclip:</sup>&nbsp;*HikariCP uses milliseconds for all time values.* <sup>&#128206;</sup>&nbsp;*HikariCP uses milliseconds for all time values.*
##### Essentials ##### Essentials
:abc:``dataSourceClassName``<br/> &#128288;``dataSourceClassName``<br/>
This is the name of the ``DataSource`` class provided by the JDBC driver. Consult the This is the name of the ``DataSource`` class provided by the JDBC driver. Consult the
documentation for your specific JDBC driver to get this class name, or see the [table](https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names) below. documentation for your specific JDBC driver to get this class name, or see the [table](https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names) below.
Note XA data sources are not supported. XA requires a real transaction manager like Note XA data sources are not supported. XA requires a real transaction manager like
@ -83,7 +83,7 @@ Note XA data sources are not supported. XA requires a real transaction manager
*- or -* *- or -*
:abc:``jdbcUrl``<br/> &#128288;``jdbcUrl``<br/>
This property directs HikariCP to use "DriverManager-based" configuration. We feel that DataSource-based This property directs HikariCP to use "DriverManager-based" configuration. We feel that DataSource-based
configuration (above) is superior for a variety of reasons (see below), but for many deployments there is configuration (above) is superior for a variety of reasons (see below), but for many deployments there is
little significant difference. When using this property with "old" drivers, you may also need to set little significant difference. When using this property with "old" drivers, you may also need to set
@ -94,7 +94,7 @@ specified in the URL itself.
*** ***
:abc:``username``<br/> &#128288;``username``<br/>
This property sets the default authentication username used when obtaining *Connections* from This property sets the default authentication username used when obtaining *Connections* from
the underlying driver. Note that for DataSources this works in a very deterministic fashion by the underlying driver. Note that for DataSources this works in a very deterministic fashion by
calling ``DataSource.getConnection(*username*, password)`` on the underlying DataSource. However, calling ``DataSource.getConnection(*username*, password)`` on the underlying DataSource. However,
@ -104,7 +104,7 @@ driver's ``DriverManager.getConnection(jdbcUrl, props)`` call. If this is not w
skip this method entirely and call ``addDataSourceProperty("username", ...)``, for example. skip this method entirely and call ``addDataSourceProperty("username", ...)``, for example.
*Default: none* *Default: none*
:abc:``password``<br/> &#128288;``password``<br/>
This property sets the default authentication password used when obtaining *Connections* from This property sets the default authentication password used when obtaining *Connections* from
the underlying driver. Note that for DataSources this works in a very deterministic fashion by the underlying driver. Note that for DataSources this works in a very deterministic fashion by
calling ``DataSource.getConnection(username, *password*)`` on the underlying DataSource. However, calling ``DataSource.getConnection(username, *password*)`` on the underlying DataSource. However,
@ -116,25 +116,25 @@ skip this method entirely and call ``addDataSourceProperty("pass", ...)``, for e
##### Frequently used ##### Frequently used
:white_check_mark:``autoCommit``<br/> &#9989;``autoCommit``<br/>
This property controls the default auto-commit behavior of connections returned from the pool. This property controls the default auto-commit behavior of connections returned from the pool.
It is a boolean value. It is a boolean value.
*Default: true* *Default: true*
:watch:``connectionTimeout``<br/> &#8986;``connectionTimeout``<br/>
This property controls the maximum number of milliseconds that a client (that's you) will wait This property controls the maximum number of milliseconds that a client (that's you) will wait
for a connection from the pool. If this time is exceeded without a connection becoming for a connection from the pool. If this time is exceeded without a connection becoming
available, a SQLException will be thrown. 100ms is the minimum value. available, a SQLException will be thrown. 100ms is the minimum value.
*Default: 30000 (30 seconds)* *Default: 30000 (30 seconds)*
:watch:``idleTimeout``<br/> &#8986;``idleTimeout``<br/>
This property controls the maximum amount of time that a connection is allowed to sit idle in the This property controls the maximum amount of time that a connection is allowed to sit idle in the
pool. Whether a connection is retired as idle or not is subject to a maximum variation of +30 pool. Whether a connection is retired as idle or not is subject to a maximum variation of +30
seconds, and average variation of +15 seconds. A connection will never be retired as idle *before* seconds, and average variation of +15 seconds. A connection will never be retired as idle *before*
this timeout. A value of 0 means that idle connections are never removed from the pool. this timeout. A value of 0 means that idle connections are never removed from the pool.
*Default: 600000 (10 minutes)* *Default: 600000 (10 minutes)*
:watch:``maxLifetime``<br/> &#8986;``maxLifetime``<br/>
This property controls the maximum lifetime of a connection in the pool. When a connection This property controls the maximum lifetime of a connection in the pool. When a connection
reaches this timeout it will be retired from the pool, subject to a maximum variation of +30 reaches this timeout it will be retired from the pool, subject to a maximum variation of +30
seconds. An in-use connection will never be retired, only when it is closed will it then be seconds. An in-use connection will never be retired, only when it is closed will it then be
@ -143,7 +143,7 @@ than any database-level connection timeout.** A value of 0 indicates no maximum
(infinite lifetime), subject of course to the ``idleTimeout`` setting. (infinite lifetime), subject of course to the ``idleTimeout`` setting.
*Default: 1800000 (30 minutes)* *Default: 1800000 (30 minutes)*
:abc:``connectionTestQuery``<br/> &#128288;``connectionTestQuery``<br/>
**If your driver supports JDBC4 we strongly recommend not setting this property.** This is for **If your driver supports JDBC4 we strongly recommend not setting this property.** This is for
"legacy" databases that do not support the JDBC4 ``Connection.isValid() API``. This is the query that "legacy" databases that do not support the JDBC4 ``Connection.isValid() API``. This is the query that
will be executed just before a connection is given to you from the pool to validate that the will be executed just before a connection is given to you from the pool to validate that the
@ -151,7 +151,7 @@ connection to the database is still alive. *Again, try running the pool without
HikariCP will log an error if your driver is not JDBC4 compliant to let you know.* HikariCP will log an error if your driver is not JDBC4 compliant to let you know.*
*Default: none* *Default: none*
:hash:``minimumIdle``<br/> &#128290;``minimumIdle``<br/>
This property controls the minimum number of *idle connections* that HikariCP tries to maintain 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 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 add additional connections quickly and efficiently. However, for maximum performance and
@ -159,7 +159,7 @@ responsiveness to spike demands, we recommend *not* setting this value and inste
HikariCP to act as a *fixed size* connection pool. HikariCP to act as a *fixed size* connection pool.
*Default: same as maximumPoolSize* *Default: same as maximumPoolSize*
:hash:``maximumPoolSize``<br/> &#128290;``maximumPoolSize``<br/>
This property controls the maximum size that the pool is allowed to reach, including both This property controls the maximum size that the pool is allowed to reach, including both
idle and in-use connections. Basically this value will determine the maximum number of idle and in-use connections. Basically this value will determine the maximum number of
actual connections to the database backend. A reasonable value for this is best determined actual connections to the database backend. A reasonable value for this is best determined
@ -168,27 +168,27 @@ available, calls to getConnection() will block for up to ``connectionTimeout`` m
before timing out. before timing out.
*Default: 10* *Default: 10*
:chart_with_upwards_trend:``metricRegistry``<br/> &#128200;``metricRegistry``<br/>
This property is only available via programmatic configuration or IoC container. This property This property is only available via programmatic configuration or IoC container. This property
allows you to specify an instance of a *Codahale/Dropwizard* ``MetricRegistry`` to be used by the allows you to specify an instance of a *Codahale/Dropwizard* ``MetricRegistry`` to be used by the
pool to record various metrics. See the [Metrics](https://github.com/brettwooldridge/HikariCP/wiki/Codahale-Metrics) pool to record various metrics. See the [Metrics](https://github.com/brettwooldridge/HikariCP/wiki/Codahale-Metrics)
wiki page for details. wiki page for details.
*Default: none* *Default: none*
:abc:``poolName``<br/> &#128288;``poolName``<br/>
This property represents a user-defined name for the connection pool and appears mainly This property represents a user-defined name for the connection pool and appears mainly
in logging and JMX management consoles to identify pools and pool configurations. in logging and JMX management consoles to identify pools and pool configurations.
*Default: auto-generated* *Default: auto-generated*
##### Infrequently used ##### Infrequently used
:white_check_mark:``initializationFailFast``<br/> &#9989;``initializationFailFast``<br/>
This property controls whether the pool will "fail fast" if the pool cannot be seeded with This property controls whether the pool will "fail fast" if the pool cannot be seeded with
initial connections successfully. If you want your application to start *even when* the initial connections successfully. If you want your application to start *even when* the
database is down/unavailable, set this property to ``false``. database is down/unavailable, set this property to ``false``.
*Default: true* *Default: true*
:negative_squared_cross_mark:``isolateInternalQueries``<br/> &#10062;``isolateInternalQueries``<br/>
This property determines whether HikariCP isolates internal pool queries, such as the This property determines whether HikariCP isolates internal pool queries, such as the
connection alive test, in their own transaction. Since these are typically read-only connection alive test, in their own transaction. Since these are typically read-only
queries, it is rarely necessary to encapsulate them in their own transaction. This queries, it is rarely necessary to encapsulate them in their own transaction. This
@ -201,41 +201,41 @@ useful for certain failover automation scenarios. When the pool is suspended, c
``getConnection()`` will *not* timeout and will be held until the pool is resumed. ``getConnection()`` will *not* timeout and will be held until the pool is resumed.
*Default: false* *Default: false*
:negative_squared_cross_mark:``readOnly``<br/> &#10062;``readOnly``<br/>
This property controls whether *Connections* obtained from the pool are in read-only mode by This property controls whether *Connections* obtained from the pool are in read-only mode by
default. Note some databases do not support the concept of read-only mode, while others provide default. Note some databases do not support the concept of read-only mode, while others provide
query optimizations when the *Connection* is set to read-only. Whether you need this property query optimizations when the *Connection* is set to read-only. Whether you need this property
or not will depend largely on your application and database. or not will depend largely on your application and database.
*Default: false* *Default: false*
:negative_squared_cross_mark:``registerMbeans``<br/> &#10062;``registerMbeans``<br/>
This property controls whether or not JMX Management Beans ("MBeans") are registered or not. This property controls whether or not JMX Management Beans ("MBeans") are registered or not.
*Default: false* *Default: false*
:abc:``catalog``<br/> &#128288;``catalog``<br/>
This property sets the default *catalog* for databases that support the concept of catalogs. This property sets the default *catalog* for databases that support the concept of catalogs.
If this property is not specified, the default catalog defined by the JDBC driver is used. If this property is not specified, the default catalog defined by the JDBC driver is used.
*Default: driver default* *Default: driver default*
:abc:``connectionInitSql``<br/> &#128288;``connectionInitSql``<br/>
This property sets a SQL statement that will be executed after every new connection creation This property sets a SQL statement that will be executed after every new connection creation
before adding it to the pool. If this SQL is not valid or throws an exception, it will be before adding it to the pool. If this SQL is not valid or throws an exception, it will be
treated as a connection failure and the standard retry logic will be followed. treated as a connection failure and the standard retry logic will be followed.
*Default: none* *Default: none*
:abc: ``connectionCustomizerClassName``<br/> &#128288;``connectionCustomizerClassName``<br/>
This property allows you to specify an implementation of the ``IConnectionCustomizer`` interface. The This property allows you to specify an implementation of the ``IConnectionCustomizer`` interface. The
``customize(Connection)`` method will be invoked on each new connection *before* it is added to the ``customize(Connection)`` method will be invoked on each new connection *before* it is added to the
pool. pool.
*Default: none* *Default: none*
:abc:``driverClassName``<br/> &#128288;``driverClassName``<br/>
HikariCP will attempt to resolve a driver through the DriverManager based solely on the ``jdbcUrl``, HikariCP will attempt to resolve a driver through the DriverManager based solely on the ``jdbcUrl``,
but for some older drivers the ``driverClassName`` must also be specified. Omit this property unless but for some older drivers the ``driverClassName`` must also be specified. Omit this property unless
you get an obvious error message indicating that the driver was not found. you get an obvious error message indicating that the driver was not found.
*Default: none* *Default: none*
:abc:``transactionIsolation``<br/> &#128288;``transactionIsolation``<br/>
This property controls the default transaction isolation level of connections returned from This property controls the default transaction isolation level of connections returned from
the pool. If this property is not specified, the default transaction isolation level defined the pool. If this property is not specified, the default transaction isolation level defined
by the JDBC driver is used. Only use this property if you have specific isolation requirements that are by the JDBC driver is used. Only use this property if you have specific isolation requirements that are
@ -243,13 +243,13 @@ common for all queries. The value of this property is the constant name from th
class such as ``TRANSACTION_READ_COMMITTED``, ``TRANSACTION_REPEATABLE_READ``, etc. class such as ``TRANSACTION_READ_COMMITTED``, ``TRANSACTION_REPEATABLE_READ``, etc.
*Default: driver default* *Default: driver default*
:watch:``leakDetectionThreshold``<br/> &#8986;``leakDetectionThreshold``<br/>
This property controls the amount of time that a connection can be out of the pool before a This property controls the amount of time that a connection can be out of the pool before a
message is logged indicating a possible connection leak. A value of 0 means leak detection message is logged indicating a possible connection leak. A value of 0 means leak detection
is disabled. Lowest acceptable value for enabling leak detection is 2000 (2 secs). is disabled. Lowest acceptable value for enabling leak detection is 2000 (2 secs).
*Default: 0* *Default: 0*
:arrow_right:``dataSource``<br/> &#10145;``dataSource``<br/>
This property is only available via programmatic configuration or IoC container. This property This property is only available via programmatic configuration or IoC container. This property
allows you to directly set the instance of the ``DataSource`` to be wrapped by the pool, rather than allows you to directly set the instance of the ``DataSource`` to be wrapped by the pool, rather than
having HikariCP construct it via reflection. This can be useful in some dependency injection having HikariCP construct it via reflection. This can be useful in some dependency injection

Loading…
Cancel
Save