PostgreSQL Memory & Connection Pool Sizing Calculator
Eliminate kernel out-of-memory (OOM) killer panics, configure optimal shared buffers, and size PgBouncer connection pools for SaaS and high-concurrency microservices.
Hardware & Workload Specifications
RAM available exclusively to the PostgreSQL database instance.
Physical or dedicated vCPU cores allocated to the VM.
Total application server container instances connecting to PostgreSQL.
Calculated Buffer Architecture
shared_buffers
8 GB
25% dedicated table cache
effective_cache_size
24 GB
75% OS filesystem cache
work_mem (per sort)
197 MB
Prevents disk spill-to-temp
max_connections
50
Capped backend processes
PgBouncer Connection Pooling Required
Your 150 application clients exceed PostgreSQL's safe core connection limit (50). Front your database with PgBouncer in transaction pooling mode with default_pool_size = 20.
# PostgreSQL Memory Configuration (Tuned by Aebibtech Calculator)
# Target: 32GB RAM, 8 CPU Cores (WEB Workload)
# Memory Tuning
shared_buffers = 8GB
effective_cache_size = 24GB
maintenance_work_mem = 2GB
work_mem = 197MB
# Connection Limits (Managed via PgBouncer)
max_connections = 50
# Write-Ahead Log (WAL) & Checkpoints
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1 # Tuned for NVMe SSD storage
# PgBouncer Configuration (Recommended)
# default_pool_size = 20
# pool_mode = transaction
# max_client_conn = 500Read the Architecture Guide
PostgreSQL Connection Pooling: PgBouncer Tuning, Transaction Modes & Connection Starvation