[all] reduce mysql-pooling to sensible defaults

Reduce the max_pool_size parameter from default 5 to 2, to reduce the
max number of connections each process needs.
Reduce connection_recycle_time from 200 to 20, to reduce life duration
of a connection, allowing faster recovery in case of failure of a
mysql-router.
Configure horizon-k8s to persist connections for 20 seconds, and enable
connection healthchecks to make sure the connection is usable.

Change-Id: Id88d5a8643b8dd2db618e18c8ad556f3e92282ba
This commit is contained in:
Guillaume Boutry 2024-06-17 11:31:47 +02:00
parent da9f54d56f
commit 90a585370c
No known key found for this signature in database
GPG Key ID: E95E3326872E55DE
11 changed files with 62 additions and 44 deletions

View File

@ -6,8 +6,7 @@ state_path = /var/lib/barbican
host_href = ""
transport_url = {{ amqp.transport_url }}
sql_connection = {{ database.connection }}
db_auto_create = false
{% include "parts/section-database" %}
{% include "parts/section-identity" %}
# XXX Region should come from the id relation here

View File

@ -25,11 +25,7 @@ cinder_internal_tenant_project_id = {{ identity_credentials.project_id }}
cinder_internal_tenant_user_id = {{ identity_credentials.username }}
{% endif -%}
[database]
{% if database.connection -%}
connection = {{ database.connection }}
{% endif -%}
connection_recycle_time = 200
{% include "parts/section-database" %}
{% include "parts/section-oslo-notifications" %}

View File

@ -21,6 +21,6 @@ enabled = True
[storage:sqlalchemy]
{% include "parts/database-connection" %}
db_auto_create = false
{% include "parts/database-connection-settings" %}
{% include "parts/section-oslo-messaging-rabbit" %}

View File

@ -161,6 +161,8 @@ DATABASES = {
'PASSWORD': '{{ database.database_password }}',
'HOST': '{{ database.database_host.split(':')[0] }}',
'PORT': '{{ database.database_host.split(':')[1] }}',
'CONN_MAX_AGE': 20,
'CONN_HEALTH_CHECKS': True,
'default-character-set': 'utf8'
}
}

View File

@ -11,7 +11,7 @@ connection = {{ api_database.connection }}
{% else -%}
connection = sqlite:////var/lib/nova/nova_api.sqlite
{% endif -%}
connection_recycle_time = 200
{% include "parts/database-connection-settings" %}
{% include "parts/section-database" %}

View File

@ -6,6 +6,7 @@ auth_strategy = keystone
[placement_database]
{% include "parts/database-connection" %}
{% include "parts/database-connection-settings" %}
{% include "parts/section-identity" %}

View File

@ -115,6 +115,8 @@ class TestPlacementOperatorCharm(test_utils.CharmTestCase):
[placement_database]
connection = mysql+pymysql://foo:hardpassword@10.0.0.10/placement_api
connection_recycle_time = 20
max_pool_size = 2
[keystone_authtoken]
auth_url = http://keystone.internal:5000

View File

@ -190,6 +190,7 @@ EXTERNAL_TEMPEST_LIBS=(
CONFIG_TEMPLATES_AODH=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -198,6 +199,9 @@ CONFIG_TEMPLATES_AODH=(
)
CONFIG_TEMPLATES_BARBICAN=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -215,6 +219,7 @@ CONFIG_TEMPLATES_CEILOMETER=(
CONFIG_TEMPLATES_CINDER=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -223,12 +228,16 @@ CONFIG_TEMPLATES_CINDER=(
)
CONFIG_TEMPLATES_CINDER_CEPH=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-oslo-messaging-rabbit"
"parts/section-oslo-notifications"
)
CONFIG_TEMPLATES_DESIGNATE=(
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -239,6 +248,7 @@ CONFIG_TEMPLATES_DESIGNATE=(
CONFIG_TEMPLATES_GLANCE=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -257,6 +267,7 @@ CONFIG_TEMPLATES_GNOCCHI=(
CONFIG_TEMPLATES_HEAT=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-trustee"
@ -271,6 +282,7 @@ CONFIG_TEMPLATES_HORIZON=(
CONFIG_TEMPLATES_KEYSTONE=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-federation"
"parts/section-middleware"
"parts/section-oslo-cache"
@ -283,6 +295,7 @@ CONFIG_TEMPLATES_KEYSTONE=(
CONFIG_TEMPLATES_MAGNUM=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -294,6 +307,7 @@ CONFIG_TEMPLATES_MAGNUM=(
CONFIG_TEMPLATES_NEUTRON=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-oslo-messaging-rabbit"
@ -306,6 +320,7 @@ CONFIG_TEMPLATES_NOVA=${CONFIG_TEMPLATES_NEUTRON[@]}
CONFIG_TEMPLATES_OCTAVIA=(
"parts/section-database"
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"ca-bundle.pem.j2"
@ -313,6 +328,7 @@ CONFIG_TEMPLATES_OCTAVIA=(
CONFIG_TEMPLATES_PLACEMENT=(
"parts/database-connection"
"parts/database-connection-settings"
"parts/section-identity"
"parts/identity-data"
"parts/section-service-user"

View File

@ -1,3 +1,3 @@
# This file is used to trigger a build.
# Change uuid to trigger a new build on every charms.
4a66cd5b-4da4-433b-a38d-564df526c15d
03381028-42a3-4a2d-9231-7a2642ede8c7

View File

@ -0,0 +1,2 @@
connection_recycle_time = 20
max_pool_size = 2

View File

@ -1,3 +1,3 @@
[database]
{% include "parts/database-connection" %}
connection_recycle_time = 200
{% include "parts/database-connection-settings" %}