Database connection pooling improvements

- Implemented new variable ``connection_recycle_time`` responsible for SQLAlchemy's connection recycling
- Set new default values for db pooling variables which are inherited from the global ones.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/819424
Change-Id: Ia507320ca552ec60d893e398ad7f68d4283539be
This commit is contained in:
Damian Dabrowski 2021-12-02 19:18:27 +01:00
parent 59e879d28a
commit b36b942aed
3 changed files with 20 additions and 8 deletions

View File

@ -108,11 +108,12 @@ keystone_database_connection_string: >-
keystone_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
keystone_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
# Database tuning
# TODO(damiandabrowski): Deprecate following variables in Yoga release: keystone_database_max_pool_size, keystone_database_pool_timeout and keystone_database_idle_timeout
keystone_database_enabled: true
keystone_database_idle_timeout: 200
keystone_database_min_pool_size: 5
keystone_database_max_pool_size: 120
keystone_database_pool_timeout: 30
keystone_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
keystone_db_max_pool_size: "{{ openstack_db_max_pool_size | default(keystone_database_max_pool_size) | default('5') }}"
keystone_db_pool_timeout: "{{ openstack_db_pool_timeout | default(keystone_database_pool_timeout) | default('30') }}"
keystone_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time | default(keystone_database_idle_timeout) | default('600') }}"
## Oslo Messaging
keystone_messaging_enabled: true

View File

@ -0,0 +1,11 @@
---
deprecations:
- |
For consistency reasons, the following variables were deprecated in favor of
the new ones in a standardized format used in other repositories.
``keystone_database_pool_timeout`` -> ``keystone_db_pool_timeout``
``keystone_database_max_pool_size`` -> ``keystone_db_max_pool_size``
``keystone_database_idle_timeout`` -> ``keystone_db_connection_recycle_time``
However, they will be supported until next Yoga release.
- |
``keystone_database_min_pool_size`` was deprecated as it's deprecated in oslo.db

View File

@ -69,10 +69,10 @@ methods = {{ keystone_auth_methods }}{% if keystone_sp_apache_mod_shib %},saml2{
{% if keystone_database_enabled | bool %}
[database]
connection = {{ keystone_database_connection_string }}
connection_recycle_time = {{ keystone_database_idle_timeout }}
min_pool_size = {{ keystone_database_min_pool_size }}
max_pool_size = {{ keystone_database_max_pool_size }}
pool_timeout = {{ keystone_database_pool_timeout }}
max_overflow = {{ keystone_db_max_overflow }}
max_pool_size = {{ keystone_db_max_pool_size }}
pool_timeout = {{ keystone_db_pool_timeout }}
connection_recycle_time = {{ keystone_db_connection_recycle_time }}
{% endif %}
{% if 'fernet' in keystone_token_provider %}