← Back to plugin index

JDBC Connection Pool

Description
Connection pool using HikariCP. See https://github.com/brettwooldridge/HikariCP for details and information about optimal configuration.
Type name
JdbcConnectionPool
Class
com.airlock.iam.core.misc.impl.persistency.db.JdbcConnectionPool
May be used by
Properties
Maximum Pool Size (maximumPoolSize)
Description

The maximum pool size is the maximum number of both idle and in-use connections that will be maintained by the pool, thus determining the maximum number of connections to the database backend (per web application). A reasonable value for this is best determined by your database environment. A rule of thumb is to set this roughly to (number of db processor cores * 2) + number of harddisks of db.

When the pool reaches this size, and no idle connections are available, getting a connection will block for up to Connection Timeout [milliseconds] milliseconds before timing out.

Attributes
Integer
Optional
Default value
20
Minimum Idle Connections (minimumIdleConnections)
Description
This determines 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 restore them quickly and efficiently. However, for maximum performance and responsiveness to spike demands, HikariCP recommends to set the same value for 'Maximum Pool Size' and 'Minimum Idle Connections' allowing HikariCP to act as a fixed size connection pool. The current default settings are a compromise to support more concurrent requests while still limiting the up-front consumption of connections.

Note that IAM creates at least one connection pool per deployed module (e.g. Loginapp, Adminapp, Service-Container). Multiple connection pools are created within a module, if differently configured connection pools are present in the configuration. Keep in mind that in multi-instance setups (active-active or horizontally scaling cloud setups) with n instances, the number of connection pools is multiplied by n.

Attributes
Integer
Optional
Default value
5
Connection Timeout [milliseconds] (connectionTimeoutInMs)
Description

Sets the maximum time in milliseconds to wait to acquire a live connection. This includes connecting and authenticating to the database and verifying the connection.

This value is also used as "login timeout" on the underlying SQL driver (if possible).

Attributes
Integer
Optional
Default value
5000
Idle Timeout [minutes] (idleTimeoutInMinutes)
Description

Sets the maximum time in minutes a connection is allowed to be idle before it is closed. This setting is useful when a firewall drops idle connections after a while, to proactively close idle connections beforehand.

This setting only applies when "Minimum Idle Connections" is defined to be less than "Maximum Pool Size". Whether a connection is retired as idle or not is subject to a maximum variation of +30 seconds (to avoid retiring many connections at the same time). A connection will never be retired as idle before this timeout. Once the pool reaches "Minimum Idle Connections", connections will no longer be retired, even if idle.

Attributes
Integer
Optional
Default value
10
Maximum Connection Lifetime [minutes] (maxLifetimeInMinutes)
Description
Sets the maximum lifetime of a connection in the pool. An in-use connection will never be retired, only when it is closed will it then be removed. On a connection-by-connection basis, minor negative attenuation is applied to avoid mass-extinction in the pool. We strongly recommend setting this value, and it should be at least 1 minute less than any database or infrastructure imposed connection time limit. A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the "Idle Timeout" setting.
Attributes
Integer
Optional
Default value
30
Leak Detection Threshold [seconds] (leakDetectionThresholdInSeconds)
Description
This sets the amount of time that a connection can be out of the pool before a message is logged (without closing the connection). This can but not necessarily has to indicate an actual connection leak. Typically, it indicates performance problems on the database.
Attributes
Integer
Optional
Default value
60
Transaction Isolation Level (transactionIsolationLevel)
Description
Determines the default transaction isolation level of connections returned from 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 common for all queries. Use one of the suggested constant names or a corresponding integer value.
Attributes
String
Optional
Suggested values
TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_NONE, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_SERIALIZABLE
Enable JMX (enableJmx)
Description
Enables the registration of JMX Management Beans ("MBeans").
Attributes
Boolean
Optional
Default value
false
Connection Init SQL (connectionInitSql)
Description
Sets an 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 treated as a connection failure and the standard retry logic will be followed. This statement is normally not needed and would only hamper the performance.
Attributes
String
Optional
Driver Class (driverClass)
Description

The class name of the JDBC driver to use. The driver must be on the class path. This property is required for preloading the correct driver class and for detecting the SQL dialect.

Legacy drivers:

  • For Oracle before 9i use oracle.jdbc.driver.OracleDriver.
  • For MySQL 5.x use com.mysql.jdbc.Driver.

Attributes
String
Mandatory
Suggested values
org.h2.Driver, com.mysql.cj.jdbc.Driver, org.mariadb.jdbc.Driver, oracle.jdbc.OracleDriver, com.microsoft.sqlserver.jdbc.SQLServerDriver, org.postgresql.Driver
URL (url)
Description
The URL (also called "connect string") to connect to the database using the JDBC driver. The exact format of the string depends on the JDBC driver and contains hostname, port and probably other information.
Attributes
String
Mandatory
Example
jdbc:h2:tcp://localhost:9001/iamdb
Example
jdbc:mysql://host:3306/iamdb
Example
jdbc:mysql://host:3306/iamdb?useSSL=true&requireSSL=true
Example
jdbc:mariadb://host:3306/iamdb
Example
jdbc:oracle:thin:@host:1521:SID
Example
jdbc:sqlserver://host:1433;databaseName=IAM
Example
jdbc:postgresql://host:5432/iamdb
User (user)
Description
The username used to login on the database.
Attributes
String
Mandatory
Example
admin
Example
dba
Example
airlock
Password (password)
Description
The password used to login on the database.
Attributes
String
Mandatory
Sensitive
Connection Test Statement (connectionTestStatement)
Description

SQL statement to test the database connection. Only use this property if your connections aren't correctly tested for validity. A JDBC 4.0 driver is usually able to test the connection validity with an internal mechanism, without an explicit test statement.

For H2 databases, a statement involving a table name should be used.

This is database specific and should be set to a query that consumes the minimal amount of load on the server.

Attributes
String
Optional
Suggested values
/* ping */ SELECT 1, SELECT NOW(), SELECT 1 FROM DUAL, SELECT COUNT(*) FROM medusa_admin
SQL Dialect (sqlDialect)
Description

The SQL dialect to use. SQL dialects have minor – but important – differences: For example, Oracle does not support auto-increment, or MSSQL requires extra information for an insert statement with default values.

With the default setting (AUTOMATIC), the dialect is automatically determined based on the "Driver Class" of the JDBC driver. When using a non-standard "Driver Class", the SQL dialect of the underlying database cannot be determined automatically and must be set to the correct value here.

Attributes
Enum
Optional
Default value
AUTOMATIC
Driver Properties (driverProperties)
Description
Additional properties that will be passed on to the JDBC driver itself.
Attributes
Plugin-List
Optional
Assignable plugins
YAML Template (with default values)

type: JdbcConnectionPool
id: JdbcConnectionPool-xxxxxx
displayName: 
comment: 
properties:
  connectionInitSql:
  connectionTestStatement:
  connectionTimeoutInMs: 5000
  driverClass:
  driverProperties:
  enableJmx: false
  idleTimeoutInMinutes: 10
  leakDetectionThresholdInSeconds: 60
  maxLifetimeInMinutes: 30
  maximumPoolSize: 20
  minimumIdleConnections: 5
  password:
  sqlDialect: AUTOMATIC
  transactionIsolationLevel:
  url:
  user: