From: Grant Slater Date: Tue, 8 Oct 2024 09:02:39 +0000 (+0100) Subject: community: Increase postgres connections, tweak mem and buffers X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/b9cb30424d335ba746182f99fecb362a1cd5be81?ds=sidebyside community: Increase postgres connections, tweak mem and buffers --- diff --git a/cookbooks/community/templates/default/data.yml.erb b/cookbooks/community/templates/default/data.yml.erb index 10cc507c9..c5c59d288 100644 --- a/cookbooks/community/templates/default/data.yml.erb +++ b/cookbooks/community/templates/default/data.yml.erb @@ -3,21 +3,20 @@ # templates: - - "templates/postgres.13.template.yml" + - "templates/postgres.13.template.yml" # NOTE UPDATE THE HOOK REPLACE FOR MAX CONNECTIONS BELOW - "templates/redis.template.yml" # any extra arguments for Docker? # docker_args: params: - db_default_text_search_config: "pg_catalog.english" - ## Set db_shared_buffers to a max of 25% of the total memory. ## will be set automatically by bootstrap based on detected RAM, or you can override - db_shared_buffers: "4096MB" + db_shared_buffers: "8192MB" ## can improve sorting performance, but adds memory usage per-connection - #db_work_mem: "40MB" + db_work_mem: "40MB" + db_max_connections: "200" env: # ensure locale exists in container, you may need to install it @@ -48,3 +47,10 @@ hooks: # m h dom mon dow command # MAILTO=? 0 4 * * * /var/lib/postgresql/take-database-backup + +run: + # Make sure this matches the postgresql version template above + - replace: + filename: "/etc/postgresql/13/main/postgresql.conf" + from: /#?max_connections *=.*/ + to: "max_connections = $db_max_connections"