-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Description
When working with MySQL and MariaDB, the database has a configuration value wait_timeout where the database terminates the connection if no statement was received for the given amount of time.
With MySQL it is essential to enable periodic connection validation on the pool side(Agroal) to ensure stability (as described from Red Hat support).
Discussion
No response
Motivation
Keycloak should provide all necessary options and a safe way to configure it for MySQL and MariaDB
Details
The following settings come into play, and need to be validated against the wait_timeout of the database. While the default is 28800 seconds (8 hours), the value can and will be configured differently for different instances.
IMHO either max lifetime, or a background validation interval with a validation query needs to be configured.
As of today, those values are not validated against the database, and there are no regular CLI options or documentation in Keycloak for this.
name: QUARKUS_DATASOURCE_JDBC_MAX_LIFETIME
value: '30000' # <= # Must be less than MySQL's wait_timeout
name: QUARKUS_DATASOURCE_JDBC_BACKGROUND_VALIDATION_INTERVAL
value: '30S'
name: QUARKUS_DATASOURCE_JDBC_VALIDATION_QUERY_SQL
value: 'SELECT 1'