From ed4f061d5000ecd1d2412494d28a31123b217dc5 Mon Sep 17 00:00:00 2001 From: Damian Dabrowski Date: Thu, 2 Dec 2021 19:20:59 +0100 Subject: [PATCH] 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 --- defaults/main.yml | 4 ++++ templates/placement.conf.j2 | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5acea0a..4d30ec8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 diff --git a/templates/placement.conf.j2 b/templates/placement.conf.j2 index 337abee..a7b87d3 100644 --- a/templates/placement.conf.j2 +++ b/templates/placement.conf.j2 @@ -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 }}