diff --git a/docker-compose.yml b/docker-compose.yml index 5d703424..43ff02a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,6 +41,19 @@ services: db: image: timescale/timescaledb:2.19.3-pg14 container_name: dereth-db + # Override PostgreSQL memory settings. The default timescaledb-tune values + # targeted a much larger machine — shared_buffers was set to 96GB on a + # 32GB host, causing the kernel to swap-thrash and leaving <100MB free. + # These values follow the standard recommendation: shared_buffers ~25% RAM, + # effective_cache_size ~50% RAM, work_mem modest to avoid multiplication + # blow-up across the ~20-connection pool. + command: > + postgres + -c shared_buffers=8GB + -c effective_cache_size=16GB + -c work_mem=16MB + -c maintenance_work_mem=1GB + -c max_wal_size=4GB environment: POSTGRES_DB: dereth POSTGRES_USER: postgres