Remove database max_pool_size customisation

The database pool size is per-worker and not shared among the workers.
Currently we incorrectly scale max_pool_size with the worker count,
resulting in an excessive number of database connections that are both
unnecessary and can exhaust the MySQL server max_connections.

With the previous formula max_pool_size = workers * 4, the resulting
connection count was exponential e.g. with 10 workers you get 400
connections but with 20 workers you get 1600. With the commonly deployed
setting of worker-multiplier=0.25 you get 20 workers on 40C/80T machines
and a 3 node HA setup was consuming 3 * 1600 = 4800 MySQL connections.

This customisation was added when rpc_workers support was added (commit
b6ff05ddfe) and I cannot find any evidence that a higher pool count is
needed, the upstream neutron project also removed it's own customisation
of 10 in deference to the oslo.db default of (LP: #1682307). So this
change appears safe and will result in only 100 connections for 20
workers instead of 1600.

Closes-Bug: #1905810
Change-Id: I39b0c17a9ca04c254b08331ac10198680ce1fa28
This commit is contained in:
Trent Lloyd 2020-11-27 11:16:43 +08:00 committed by Billy Olsen
parent ed1bbfd769
commit 074e577791
1 changed files with 0 additions and 1 deletions

View File

@ -1,5 +1,4 @@
{% if database_host -%}
[database]
connection = {{ database_type }}://{{ database_user }}:{{ database_password }}@{{ database_host }}/{{ database }}{% if database_ssl_ca %}?ssl_ca={{ database_ssl_ca }}{% if database_ssl_cert %}&ssl_cert={{ database_ssl_cert }}&ssl_key={{ database_ssl_key }}{% endif %}{% endif %}
max_pool_size = {{ workers * 4 }}
{% endif -%}