From 652f278474a179e899dd8d5516a69263bb1add87 Mon Sep 17 00:00:00 2001 From: Daan Meijer Date: Tue, 13 Oct 2026 10:17:24 +0200 Subject: [PATCH] Postgres WAL on the NVMe; wal_buffers 64 MB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every commit waited on the WAL in ./pg on the HDD (WALWrite; the HDD 100% busy, 56–70 ms a write): prober flushes and claims took most of each minute. A PG_WAL_DIR volume (default /var/lib/usenet-rebuild-wal) at /var/lib/postgresql/wal, with data/pg_wal a symlink to it (set up by hand once, with Postgres stopped). Co-Authored-By: Claude Opus 5.5 --- deploy/README.md | 2 +- deploy/compose.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy/README.md b/deploy/README.md index 966dc5a..974d33a 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -13,7 +13,7 @@ homelab with the deploy key, whose forced command | Service | Image | Does | |---|---|---| -| `postgres` | postgres:17 | the catalog (tablespace `nvme`) and the chunks (HDD) | +| `postgres` | postgres:17 | the catalog (tablespace `nvme`) and the WAL (`PG_WAL_DIR`, `data/pg_wal` a symlink to it) on the NVMe; the chunks (HDD) | | `migrate` | `usenet-rebuild` (target `app`) | `migration:run`, before every deploy | | `web` | `usenet-rebuild` | catalog API, Newznab, web interface; port 3334 (`HTTP_ROUTES=public`) | | `node-api` | `usenet-rebuild` | the edge workers' API (leases, streams, batches); port 3335 on the compose network only (`HTTP_ROUTES=node`) | diff --git a/deploy/compose.yaml b/deploy/compose.yaml index 7db031c..53ade17 100644 --- a/deploy/compose.yaml +++ b/deploy/compose.yaml @@ -42,6 +42,9 @@ services: # nvme, the database's default_tablespace (LOG.md 2026-10-09 (14)). - ./pg:/var/lib/postgresql/data - ${PG_NVME_DIR:-/var/lib/usenet-rebuild-catalog}:/var/lib/postgresql/nvme + # The WAL on the NVMe too: data/pg_wal is a symlink to /var/lib/postgresql/wal. On the HDD every commit + # waited on it (WALWrite, 56–70 ms a write with the HDD 100% busy; LOG.md 2026-10-13 (43)). + - ${PG_WAL_DIR:-/var/lib/usenet-rebuild-wal}:/var/lib/postgresql/wal # synchronous_commit = off is set with ALTER SYSTEM (postgresql.auto.conf in the data dir). command: - postgres @@ -53,6 +56,8 @@ services: - max_wal_size=8GB - -c - checkpoint_timeout=15min + - -c + - wal_buffers=64MB shm_size: 1g stop_grace_period: 120s healthcheck: