From c3a8fc19a282f7039f4f03cb04149252c002f19a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Fri, 19 Nov 2021 10:59:05 +0100 Subject: [PATCH] templates: bump max postgres connections to 10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, pgxpool.Pool has 4 connections (or number of cpus if higher). Currently, we have 3 replicas, that means max 3*4=12 DB connections. The dequeue operation is actually blocking - when a worker is waiting for a job, one connection is blocked. My theory is that with 16 workers, we just don't have enough connections that causes all sorts of weird slowdowns. This commit bumps the number of connection from one replica to 10, therefore we should be at 30 connections in total. Signed-off-by: Ondřej Budai --- templates/composer.yml | 5 +++++ test/cases/api.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/templates/composer.yml b/templates/composer.yml index 032e91e3a..b4c0497f0 100644 --- a/templates/composer.yml +++ b/templates/composer.yml @@ -92,6 +92,8 @@ objects: key: db.password - name: PGSSLMODE value: "${PGSSLMODE}" + - name: PGMAXCONNS + value: "${PGMAXCONNS}" ports: - name: composer-api protocol: TCP @@ -229,6 +231,9 @@ parameters: - description: postgres sslmode to use when connecting to the db name: PGSSLMODE value: "require" + - description: postgres maximum connections per pod + name: PGMAXCONNS + value: "10" - description: base sso url name: SSO_BASE_URL required: true diff --git a/test/cases/api.sh b/test/cases/api.sh index 6eed1240a..e36883e3a 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -79,6 +79,7 @@ pg_database = "osbuildcomposer" pg_user = "postgres" pg_password = "foobar" pg_ssl_mode = "disable" +pg_max_conns = 10 EOF sudo systemctl restart osbuild-composer