From 9917b519581f03e27377c7e6e6dc483d137ac3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Fri, 16 Dec 2022 21:34:24 -0500 Subject: [PATCH 1/2] feat: add postgresql.conf --- docker-compose.yml | 1 + postgresql.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 postgresql.conf diff --git a/docker-compose.yml b/docker-compose.yml index bacca813..922e276b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,6 +41,7 @@ services: POSTGRES_PASSWORD: nostr_ts_relay volumes: - pgdata:/var/lib/postgresql/data/ + - ./postgresql.conf:/etc/postgresql.conf ports: - 15432:5432 networks: diff --git a/postgresql.conf b/postgresql.conf new file mode 100644 index 00000000..f9a849e2 --- /dev/null +++ b/postgresql.conf @@ -0,0 +1,27 @@ +# DB Version: 15 +# OS Type: linux +# DB Type: oltp +# Total Memory (RAM): 8 GB +# CPUs num: 4 +# Connections num: 60 +# Data Storage: ssd + +max_connections = 60 +shared_buffers = 2GB +effective_cache_size = 6GB +maintenance_work_mem = 512MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 17476kB +min_wal_size = 2GB +max_wal_size = 8GB +max_worker_processes = 4 +max_parallel_workers_per_gather = 2 +max_parallel_workers = 4 +max_parallel_maintenance_workers = 2 + +logging_collector = on +log_min_duration_statement = 500 From dded52084d27f5cc6113bb2c0160f6fd6ff98800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Arturo=20Cabral=20Mej=C3=ADa?= Date: Fri, 16 Dec 2022 22:20:58 -0500 Subject: [PATCH 2/2] chore: bump connections --- docker-compose.yml | 2 +- postgresql.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 922e276b..407bbfb4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: DB_PASSWORD: nostr_ts_relay DB_NAME: nostr_ts_relay DB_MIN_POOL_SIZE: 5 - DB_MAX_POOL_SIZE: 15 + DB_MAX_POOL_SIZE: 25 REDIS_HOST: cache REDIS_PORT: 6379 REDIS_USER: default diff --git a/postgresql.conf b/postgresql.conf index f9a849e2..0882425c 100644 --- a/postgresql.conf +++ b/postgresql.conf @@ -6,7 +6,7 @@ # Connections num: 60 # Data Storage: ssd -max_connections = 60 +max_connections = 100 shared_buffers = 2GB effective_cache_size = 6GB maintenance_work_mem = 512MB