PostgreSQL background writer and checkpoint IO spikes after increasing shared_buffers on primary
Environment
PostgreSQL 13 on Debian 11, 48 GB RAM, NVMe RAID on controller with battery-backed write cache; workload: OLTP with peak 2000 TPS; changed shared_buffers from 4GB to 16GB and restarted PostgreSQL at 02:00 during low traffic
Symptoms
After the change, periodic IO spikes observed: write latency climbs to >50ms and CPU kernel time increases during checkpoints; application experiences transient slow queries and timeouts during bursts; spikes every 5–10 minutes correlate with bgwriter/checkpoint activity
Observations
postgresql.conf: shared_buffers=16GB, checkpoint_timeout=5min, max_wal_size=1GB (default prior). vmstat/iostat show large synchronous write bursts at checkpoint times; pg_stat_bgwriter shows increased checkpoints_timed and buffers_backend_wal writes; pg_wal usage grows then flushes; autovacuum appears unaffected. No OS-level OOMs. Disk write cache setting is enabled on RAID controller. WAL fsync reports occasional 'write' latency in pg_stat_activity timings.
Already attempted
Rolled shared_buffers back to 8GB in a test instance — write spikes reduced but not eliminated; increased max_wal_size to 4GB on a dev replica — checkpoint frequency reduced and IO spikes smoothed in replica; ensured commit_delay/commit_siblings left at defaults; upgraded PostgreSQL minor version — no change.
Question
Why did increasing shared_buffers to 16GB cause larger, more disruptive checkpoint IO bursts, and what server-side tunables and storage checks will reduce write latency and checkpoint impact without rolling back shared_buffers entirely?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Databases26% match
PostgreSQL standby stops applying WAL during long-running transactions on primary after pg_basebackup restore
Open0 answers - Databases25% match
pg_dump fails intermittently with 'could not serialize access' during high-concurrency writes on PostgreSQL 13
Open0 answers - Databases24% match
PostgreSQL primary WAL sender CPU spikes and replication lag after enabling frequent TLS renegotiation on streaming replication
Open0 answers - Hardware23% match
NVMe SSD Reallocated Sector Count increases only during heavy random-write FIO workload on Linux
Open0 answers - Databases23% match
PostgreSQL replica falls behind and reports WAL streaming delay when frequent autovacuum runs on primary
Open0 answers