From afd9a84a6869f77c647a75c704fc797ff4f2ba41 Mon Sep 17 00:00:00 2001 From: Shimon Shtein Date: Sun, 5 May 2024 13:51:48 +0300 Subject: [PATCH] Update the db_pool value The new value should be at least the number of puma threads + 4. More details: https://community.theforeman.org/t/rails-connection-pool-size-optimizations/36675 --- .../foreman.migrations/20240505103832_change_db_pool_size.rb | 4 ++++ config/katello.migrations/240506081834-change-db-pool-size.rb | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 config/foreman.migrations/20240505103832_change_db_pool_size.rb create mode 100644 config/katello.migrations/240506081834-change-db-pool-size.rb diff --git a/config/foreman.migrations/20240505103832_change_db_pool_size.rb b/config/foreman.migrations/20240505103832_change_db_pool_size.rb new file mode 100644 index 00000000..3587d457 --- /dev/null +++ b/config/foreman.migrations/20240505103832_change_db_pool_size.rb @@ -0,0 +1,4 @@ +if answers['foreman'].is_a?(Hash) && answers.dig('foreman', 'db_pool') + puma_threads_max = answers.dig('foreman', 'foreman_service_puma_threads_max').to_i + answers['foreman']['db_pool'] = [answers.dig('foreman', 'db_pool').to_i, puma_threads_max + 4, 5].max +end diff --git a/config/katello.migrations/240506081834-change-db-pool-size.rb b/config/katello.migrations/240506081834-change-db-pool-size.rb new file mode 100644 index 00000000..7a437548 --- /dev/null +++ b/config/katello.migrations/240506081834-change-db-pool-size.rb @@ -0,0 +1,3 @@ +if answers['foreman'].is_a?(Hash) && answers.dig('foreman', 'db_pool').to_i == 5 + answers['foreman']['db_pool'] = nil +end