From 074e577791e9313ad36bc313475ef6bcbf7adce6 Mon Sep 17 00:00:00 2001 From: Trent Lloyd Date: Fri, 27 Nov 2020 11:16:43 +0800 Subject: [PATCH] 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 --- templates/parts/section-database | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/parts/section-database b/templates/parts/section-database index be0071fa..ae4a5ba0 100644 --- a/templates/parts/section-database +++ b/templates/parts/section-database @@ -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 -%}