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: I77b4e8c70a21eada431c824044c0d1563df70dcc
This commit is contained in:
Damian Dabrowski 2021-12-02 19:20:59 +01:00
parent f8e279cc3d
commit ed4f061d50
2 changed files with 9 additions and 1 deletions

View File

@ -47,6 +47,10 @@ placement_galera_user: placement
placement_galera_use_ssl: "{{ galera_use_ssl | default(False) }}"
placement_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}"
placement_galera_port: "{{ galera_port | default('3306') }}"
placement_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}"
placement_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}"
placement_db_pool_timeout: "{{ openstack_db_pool_timeout | default('30') }}"
placement_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time | default('600') }}"
## Placement User / Group
placement_system_user_name: placement

View File

@ -19,4 +19,8 @@ memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcached_encryption_key }}
[placement_database]
connection = mysql+pymysql://{{ placement_galera_user }}:{{ placement_galera_password }}@{{ placement_galera_address }}/{{ placement_galera_database }}?charset=utf8{% if placement_galera_use_ssl | bool %}&ssl_verify_cert=true{% if placement_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ placement_galera_ssl_ca_cert }}{% endif %}{% endif %}
connection = mysql+pymysql://{{ placement_galera_user }}:{{ placement_galera_password }}@{{ placement_galera_address }}/{{ placement_galera_database }}?charset=utf8{% if placement_galera_use_ssl | bool %}&ssl_verify_cert=true{% if placement_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ placement_galera_ssl_ca_cert }}{% endif %}{% endif +%}
max_overflow = {{ placement_db_max_overflow }}
max_pool_size = {{ placement_db_max_pool_size }}
pool_timeout = {{ placement_db_pool_timeout }}
connection_recycle_time = {{ placement_db_connection_recycle_time }}