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: Ic58f085c8b1250b1db831fa8c74215abd2519704
This commit is contained in:
Damian Dabrowski 2021-12-02 19:18:50 +01:00
parent f34ec895b9
commit 3e642f2f72
2 changed files with 8 additions and 1 deletions

View File

@ -163,6 +163,10 @@ barbican_galera_user: barbican
barbican_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
barbican_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
barbican_galera_port: "{{ galera_port | default('3306') }}"
# NOTE: barbican does not support pool_timeout so it is not set for this role
barbican_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
barbican_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}"
barbican_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time | default('600') }}"
## Oslo Messaging
barbican_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"

View File

@ -12,7 +12,10 @@ debug = {{ debug }}
# communicate back with this service.
host_href = {{ barbican_service_publicurl }}
sql_connection = mysql+pymysql://{{ barbican_galera_user }}:{{ barbican_galera_password }}@{{ barbican_galera_address }}/{{ barbican_galera_database }}?charset=utf8{% if barbican_galera_use_ssl | bool %}&ssl_verify_cert=true{% if barbican_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ barbican_galera_ssl_ca_cert }}{% endif %}{% endif %}
sql_connection = mysql+pymysql://{{ barbican_galera_user }}:{{ barbican_galera_password }}@{{ barbican_galera_address }}/{{ barbican_galera_database }}?charset=utf8{% if barbican_galera_use_ssl | bool %}&ssl_verify_cert=true{% if barbican_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ barbican_galera_ssl_ca_cert }}{% endif %}{% endif +%}
sql_pool_max_overflow = {{ barbican_db_max_overflow }}
sql_pool_size = {{ barbican_db_max_pool_size }}
sql_idle_timeout = {{ barbican_db_connection_recycle_time }}
# Rabbit and HA configuration:
ampq_durable_queues = True