Configuring Database Pool of Management and LDAP Replicator
This article will help you with the configuration of the database connection pool.
Tomcat JDBC Connection Pool Configuration
The configuration is stored in <install_dir>\Management\conf\safeq.properties.
Management connection pool uses application for basic database operations:
Default properties of Management connection pool
# The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
database.connections.max = 50
# The initial number of connections to create when the pool is started.
database.connections.min = 5
# The minimum number of established connections that should be kept in the pool at all times.
# The connection pool can shrink below this number if validation queries fail. The default value is derived from initialSize.
database.idle.min = 5
# The number of seconds to set for the query timeout. A value less than or equal to zero will disable this feature.
database.connections.queryTimeout = 120
# Number of milliseconds before running a validation check to ensure that the JDBC connection is still valid.
# A connection that has been validated within this interval is not revalidated. Running validation checks too frequently can slow performance.
database.connections.cleanerPeriod = 10000
# Set to true if you want the connection pool to rollback any pending transaction when a connection is returned.
database.rollback.on.return = true
# Indicates whether objects are validated before borrowed from the pool.
# If the object fails to validate, it is dropped from the pool, and an attempt is made to borrow another.
database.test.on.borrow = false
# Indicates if objects are validated before they are returned to the pool.
database.test.on.return = true
# Indicates whether objects are validated by the idle object evictor (if any). If an object fails to validate, it is dropped from the pool.
database.test.while.idle = true
# Set to true to remove abandoned connections if they exceed the removeAbandonedTimeout.
# Setting this to true can recover database connections from poorly written applications that fail to close a connection.
# A connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout.
database.remove.abandoned = true
# Timeout in seconds before an abandoned connection can be removed. The value should be set to the longest running query your applications might have.
database.remove.abandoned.timeout = 120
# The SQL query used to validate connections from this pool before returning them to the caller.
# If specified, the query must be an SQL SELECT statement that returns at least one row.
database.validation.query = SELECT 1
# The maximum milliseconds a pool with no available connections will wait for a connection to be returned before throwing an exception, or -1 to wait indefinitely.
database.max.wait = 30000
# The number of milliseconds to sleep between runs of the idle object evictor thread.
# The thread checks for idle, abandoned connections and validates idle connections. The value should not be set below 1 second (1000).
database.time.between.eviction.runs.millis = 5000
# The minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor, if any.
database.min.evictable.idle.time.millis = 60000
# Time in milliseconds to keep this connection. This attribute works both when returning connection and when borrowing connection.
# When a connection is borrowed from the pool, the pool will check to see if the now - time-when-connected > maxAge has been reached,
# and if so, it reconnects before borrow it. When a connection is returned to the pool, the pool will check to see if the now - time-when-connected > maxAge
# has been reached, and if so, it closes the connection rather than returning it to the pool. The default value is 0,
# which implies that connections will be left open and no age check will be done upon borrowing from the pool and returning the connection to the pool.
database.max.age.millis = 60000
Management warehouse connection pool uses application for reporting database operations:
Default properties of Management warehouse connection pool
# The maximum number of active connections that can be allocated from this pool at the same time, or negative for no limit.
databaseWarehouse.connections.max = 10
# The initial number of connections to create when the pool is started.
databaseWarehouse.connections.min = 1
# The minimum number of established connections that should be kept in the pool at all times.
# The connection pool can shrink below this number if validation queries fail. The default value is derived from initialSize.
databaseWarehouse.idle.min = 1
# The number of seconds to set for the query timeout. A value less than or equal to zero will disable this feature.
databaseWarehouse.connections.queryTimeout = 1800
# Number of milliseconds before running a validation check to ensure that the JDBC connection is still valid.
# A connection that has been validated within this interval is not revalidated. Running validation checks too frequently can slow performance.
databaseWarehouse.connections.cleanerPeriod = 10000
# Set to true if you want the connection pool to rollback any pending transaction when a connection is returned.
databaseWarehouse.rollback.on.return = true
# Indicates whether objects are validated before borrowed from the pool.
# If the object fails to validate, it is dropped from the pool, and an attempt is made to borrow another.
databaseWarehouse.test.on.borrow = false
# Indicates if objects are validated before they are returned to the pool.
databaseWarehouse.test.on.return = true
# Indicates whether objects are validated by the idle object evictor (if any). If an object fails to validate, it is dropped from the pool.
databaseWarehouse.test.while.idle = true
# Set to true to remove abandoned connections if they exceed the removeAbandonedTimeout.
# Setting this to true can recover database connections from poorly written applications that fail to close a connection.
# A connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout.
databaseWarehouse.remove.abandoned = true
# Timeout in seconds before an abandoned connection can be removed. The value should be set to the longest running query your applications might have.
databaseWarehouse.remove.abandoned.timeout = 1800
# The SQL query used to validate connections from this pool before returning them to the caller.
# If specified, the query must be an SQL SELECT statement that returns at least one row.
databaseWarehouse.validation.query = SELECT 1
# The maximum milliseconds a pool with no available connections will wait for a connection to be returned before throwing an exception, or -1 to wait indefinitely.
databaseWarehouse.max.wait = 30000
# The number of milliseconds to sleep between runs of the idle object evictor thread.
# The thread checks for idle, abandoned connections and validates idle connections. The value should not be set below 1 second (1000).
databaseWarehouse.time.between.eviction.runs.millis = 5000
# The minimum amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object evictor, if any.
databaseWarehouse.min.evictable.idle.time.millis = 60000
# Time in milliseconds to keep this connection. This attribute works both when returning connection and when borrowing connection.
# When a connection is borrowed from the pool, the pool will check to see if the now - time-when-connected > maxAge has been reached,
# and if so, it reconnects before borrow it. When a connection is returned to the pool, the pool will check to see if the now - time-when-connected > maxAge
# has been reached, and if so, it closes the connection rather than returning it to the pool. The default value is 0,
# which implies that connections will be left open and no age check will be done upon borrowing from the pool and returning the connection to the pool.
databaseWarehouse.max.age.millis = 60000
If you change the configuration, you must restart the proper service: YSoft SafeQ Management Service service or YSoft SafeQ LDAP Replicator service.
The configuration of the PostgeSQL database is stored in <install_dir>\Management>\PGSQL-data\postgresql.conf.
PostgreSQL connection properties
max_connections = 120
If you change the configuration, you must restart the YSoft Bundled PostgreSQL 9.4 service.