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: I9609542a2d0de17c9e7a148f5a21ac1e47a390ac
This commit is contained in:
Damian Dabrowski 2021-12-02 19:18:05 +01:00 committed by Dmitriy Rabotyagov
parent eb4ed919e1
commit 2134df4c53
3 changed files with 15 additions and 6 deletions

View File

@ -217,9 +217,11 @@ neutron_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter |
neutron_galera_address: "{{ galera_address | default('127.0.0.1') }}"
neutron_galera_user: neutron
neutron_galera_database: neutron
neutron_db_max_overflow: 20
neutron_db_pool_size: 120
neutron_db_pool_timeout: 30
neutron_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
# TODO(damiandabrowski): Remove neutron_db_pool_size in Yoga release
neutron_db_max_pool_size: "{{ openstack_db_max_pool_size | default(neutron_db_pool_size) | default('5') }}"
neutron_db_pool_timeout: "{{ openstack_db_pool_timeout | default('30') }}"
neutron_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time | default('600') }}"
neutron_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
neutron_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
neutron_galera_port: "{{ galera_port | default('3306') }}"

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
For consistency reasons, ``neutron_db_pool_size`` was deprecated in favor of
``neutron_db_max_pool_size`` which is in a standardized format used in other
repositories.
However, it will be supported until Yoga release.

View File

@ -197,11 +197,11 @@ memcache_use_advanced_pool = True
# Database
[database]
connection = mysql+pymysql://{{ neutron_galera_user }}:{{ neutron_container_mysql_password }}@{{ neutron_galera_address }}/{{ neutron_galera_database }}?charset=utf8{% if neutron_galera_use_ssl | bool %}&ssl_verify_cert=true{% if neutron_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ neutron_galera_ssl_ca_cert }}{% endif %}{% endif %}
connection = mysql+pymysql://{{ neutron_galera_user }}:{{ neutron_container_mysql_password }}@{{ neutron_galera_address }}/{{ neutron_galera_database }}?charset=utf8{% if neutron_galera_use_ssl | bool %}&ssl_verify_cert=true{% if neutron_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ neutron_galera_ssl_ca_cert }}{% endif %}{% endif +%}
max_overflow = {{ neutron_db_max_overflow }}
max_pool_size = {{ neutron_db_pool_size }}
max_pool_size = {{ neutron_db_max_pool_size }}
pool_timeout = {{ neutron_db_pool_timeout }}
connection_recycle_time = {{ neutron_db_connection_recycle_time }}
# Service providers
[service_providers]