From 991608fd4e407d6dcec71dba7db72bf802580ce6 Mon Sep 17 00:00:00 2001 From: Klention Mali <45871249+klention@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:15:55 +0100 Subject: [PATCH] Auto se the number of max_worker_processes and max_parallel_workers based on system resources (#853) --- automation/vars/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automation/vars/main.yml b/automation/vars/main.yml index 7ef57c851..e8fa0c4fc 100644 --- a/automation/vars/main.yml +++ b/automation/vars/main.yml @@ -315,8 +315,8 @@ postgresql_parameters: - { option: "wal_receiver_status_interval", value: "10s" } - { option: "idle_in_transaction_session_timeout", value: "10min" } # reduce this timeout if possible - { option: "jit", value: "off" } - - { option: "max_worker_processes", value: "24" } - - { option: "max_parallel_workers", value: "8" } + - { option: "max_worker_processes", value: "{{ [ansible_processor_vcpus | int, 16] | max }}" } + - { option: "max_parallel_workers", value: "{{ [(ansible_processor_vcpus | int // 2), 8] | max }}" } - { option: "max_parallel_workers_per_gather", value: "2" } - { option: "max_parallel_maintenance_workers", value: "2" } - { option: "tcp_keepalives_count", value: "10" }