KMS & Stack Tuning
PostgreSQL 16 shared_buffers, work_mem & DB_POOL_MAX Sizing
Prevent connection saturation when multiple Fastify pods and BullMQ workers query Infisical secrets concurrently.
shared_buffers=25% RAM · DB_POOL_MAX 20-90 · zstd WAL
Matching Node Pool to Postgres max_connections
Never set DB_POOL_MAX above max_connections divided by replica count. Keep at least 25 reserved connections for migrations, pg_dump backups, and admin consoles.
Enabling wal_compression=zstd
Secret version writes and audit log inserts generate continuous WAL traffic; zstd compression reduces NVMe write amplification by roughly 40%.
Measured Thresholds & KMS Configuration
| Host RAM | shared_buffers | Safe DB_POOL_MAX |
|---|---|---|
| 4 GB VPS | 1024 MB | 25 - 35 connections |
| 8 GB VPS | 2048 MB | 45 - 60 connections |
| 16 - 32 GB Node | 4096 MB | 75 - 110 connections |