From 0e8bb06de57a86d087fce76058d9e40748afd52a Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 11 Dec 2024 16:59:24 +0100 Subject: [PATCH] Fixes #38085 - Cap the number of Puma workers at 100 Users can easily run out of PostgreSQL connections on large deployments. This provides a ceiling to the automatically calculated Puma workers because it's unclear if that really provides performance benefits while it can break deployments. Not noticable here, but foreman-installer defaults to max 500 PostgreSQL connections and has tuning options that to increase it to 1000. Ideally it would be smarter, but it's really hard to account for all possible conditions. --- manifests/config.pp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manifests/config.pp b/manifests/config.pp index 5007126f..9572f367 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -86,12 +86,14 @@ content => epp('foreman/database.yml.epp', $db_context), } + # Capped at 100 because worst case that's 100 * (5 + 4) = 900 PostgreSQL connections for Katello or 100 * 5 = 500 for vanilla Foreman # CPU based calculation is based on https://github.com/puma/puma/blob/master/docs/deployment.md#mri # Memory based calculation is based on https://docs.gitlab.com/ee/install/requirements.html#puma-settings $puma_workers = pick( $foreman::foreman_service_puma_workers, floor( min( + 100, $facts['processors']['count'] * 1.5, ($facts['memory']['system']['total_bytes']/(1024 * 1024 * 1024)) - 1.5 )