From ea329d1f815c0951d67230da6d0118841908c6b1 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 ++++ 1 file changed, 4 insertions(+) create mode 100644 config/foreman.migrations/20240505103832_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..1921a7ca --- /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].max +end