From 3106e5abbbda4c5b2c935cfd7fd68bbee14485be Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 26 May 2025 16:18:41 +0100 Subject: [PATCH] feat: suggestion of more optimum settings for postgres --- CHANGELOG.md | 1 + compose-partner-chains.yml | 2 ++ postgresql.conf | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 postgresql.conf diff --git a/CHANGELOG.md b/CHANGELOG.md index cb24ad5..c0b003a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 🚀 Features +- Optimise postgres config - Switch networks by altering CFG_PRESET only - Added `test.sh` to detect problems and provide solutions. - Added `reset-midnight.sh` script to clear down midnight's blockchain. diff --git a/compose-partner-chains.yml b/compose-partner-chains.yml index 6f387b2..efaed3a 100644 --- a/compose-partner-chains.yml +++ b/compose-partner-chains.yml @@ -44,6 +44,8 @@ services: - POSTGRES_USER=${POSTGRES_USER} volumes: - postgres-data:/var/lib/postgresql/data + - ./postgresql.conf:/etc/postgresql.conf + command: postgres -c config_file=/etc/postgresql.conf -c listen_addresses='*' ports: - "${POSTGRES_PORT}:${POSTGRES_PORT}" healthcheck: diff --git a/postgresql.conf b/postgresql.conf new file mode 100644 index 0000000..22fbcb3 --- /dev/null +++ b/postgresql.conf @@ -0,0 +1,24 @@ +# Tuned from https://pgtune.leopard.in.ua/?dbVersion=15&osType=linux&dbType=oltp&cpuNum=1&totalMemory=1&totalMemoryUnit=GB&connectionNum=20&hdType=ssd +# (Please regenerate when altering postgres versions.) +# +# DB Version: 15 +# OS Type: linux +# DB Type: oltp +# Total Memory (RAM): 3 GB +# CPUs num: 1 +# Connections num: 20 +# Data Storage: ssd + +max_connections = 20 +shared_buffers = 768MB +effective_cache_size = 2304MB +maintenance_work_mem = 192MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 28086kB +huge_pages = off +min_wal_size = 2GB +max_wal_size = 8GB