HikariCP properties
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.
Summary
"HikariCP is solid high-performance JDBC connection pool. A connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required. Connection pools may significantly reduce the overall resource usage." - You can find out more here.
Properties
Atlassian HikariCP configuration is already set by default in the bamboo.cfg.xml.
<property name="hibernate.hikari.idleTimeout">600000</property>
<property name="hibernate.hikari.maximumPoolSize">250</property>
<property name="hibernate.hikari.minimumIdle">3</property> // When minimumIdle is not set it won't limit connections. It will consider the maximumPoolSize already set which is recommended.
<property name="hibernate.hikari.registerMbeans">true</
idleTimeout
The default is 600000 milliseconds, or 10 minutes. If idleTimeout+1 second > maxLifetime and maxLifetime>0, it will be reset to 0; If idleTimeout! =0 and less than 10 seconds, it will be reset to 10 seconds. If idleTimeout=0, idle connections will never be removed from the connection pool.
This parameter takes effect only when the minimumIdle is less than maximumPoolSize, and is removed when the number of idle connections exceeds the minimumIdle and the idle time exceeds idleTimeout.
minimumIdle
Controls the minimum number of connection pool idle connections. When the connection pool idle connections are less than minimumIdle and the total number of connections is not more than maximumPoolSize, HikariCP will try its best to supplement new connections. For performance consideration, it is not recommended to set this value, but let HikariCP treat connection pool as a fixed size. the default minimum is the same as maximumPoolSize.
When minIdle<0 or minIdle>maxPoolSize, it is reset to maxPoolSize, which defaults to 10.
Configuration
According to Hikari Pool Sizing and Github HikariCP:
- HikariPool does expose the number of active connections, but it's only for JMX.
- HikariDataSource doesn't expose any way to get the HikariPool.
- Hikari doesn't offer any type of listener for pool interactions, like trying to track when connections are checked in and out.
- Hikari prefers using a DataSource, per their documentation.
- Some functionality, like statement caching, needs to be configured in the DataSource's properties; Hikari itself doesn't offer that functionality.
Database pooling is now handled by HikariCP for the 4.0 release.
The properties are:
Parameters | Value | Description |
db.pool.size.idle | 0 | The number of connections the pool tries to keep open and idle. By default, idle connections are not eagerly created (they will be replaced (up to this value) fairly quickly – ~15 sec on average, or immediately if requests outnumber available connections). |
db.pool.size.max | 80 | The maximum number of connections in the pool. (4 partitions each with 20 connections), so the default maximum has not changed.
|
db.pool.timeout.connect | 15 | The number of seconds the pool will wait for a connection to become available.
|
db.pool.timeout.idle | 18000 | The number of seconds the pool will allow a connection to remain idle before closing it.
|
db.pool.timeout.leak | 0 | The number of minutes a connection is allowed to remain open before the system flags it as “leaked” and logs a warning.
|
db.pool.timeout.lifetime | 30 | The number of minutes a connection is allowed to remain open. When this timeout is exceeded, the next time the connection is released to the pool it is closed, and a new connection is opened to replace it |
The following settings have been removed without replacement:
- db.pool.acquireIncrement - HikariCP opens connections one at a time, as needed;
- db.pool.cache.statements - HikariCP does not offer statement caching;
- db.pool.idle.testInterval - HikariCP tests connections when they’re leased, not on a timer;
- db.pool.connection.threshold - HikariCP doesn’t have a percentile idle threshold;
- db.pool.size.idle - can be used to keep a fixed number of connections idle;
- db.pool.threads - HikariCP does not use extra threads to “aid” connection release;