reduce cnpg connections, but increase working memory

This commit is contained in:
2026-01-05 19:55:38 +01:00
parent 91e6e2e502
commit 8ff8126d41

View File

@@ -12,7 +12,7 @@ spec:
# Use CloudNativePG-compatible PostGIS image # Use CloudNativePG-compatible PostGIS image
# imageName: ghcr.io/cloudnative-pg/postgresql:16.6 # Standard image # imageName: ghcr.io/cloudnative-pg/postgresql:16.6 # Standard image
imageName: <YOUR_REGISTRY_URL>/library/cnpg-postgis:16.6-3.4-v2 imageName: registry.keyboardvagabond.com/library/cnpg-postgis:16.6-3.4-v2
# Bootstrap with initial database and user # Bootstrap with initial database and user
bootstrap: bootstrap:
@@ -31,20 +31,21 @@ spec:
- CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
# PostgreSQL configuration for conservative scaling (3GB memory limit) # PostgreSQL configuration for conservative scaling (4GB memory limit)
postgresql: postgresql:
parameters: parameters:
# Performance optimizations for 3GB memory limit # Performance optimizations for 4GB memory limit
max_connections: "300" # Reduced max_connections based on actual usage (7 connections observed)
shared_buffers: "768MB" # 25% of 3GB memory limit max_connections: "150"
effective_cache_size: "2.25GB" # ~75% of 3GB memory limit shared_buffers: "1GB" # 25% of 4GB memory limit
maintenance_work_mem: "192MB" # Scaled for 3GB memory limit effective_cache_size: "3GB" # ~75% of 4GB memory limit
maintenance_work_mem: "256MB" # Scaled for 4GB memory limit
checkpoint_completion_target: "0.9" checkpoint_completion_target: "0.9"
wal_buffers: "24MB" wal_buffers: "24MB"
default_statistics_target: "100" default_statistics_target: "100"
random_page_cost: "1.1" # Good for SSD storage random_page_cost: "1.1" # Good for SSD storage
effective_io_concurrency: "200" effective_io_concurrency: "200"
work_mem: "12MB" # Conservative: 300 connections = ~3.6GB total max work_mem: "24MB" # Increased from 14MB: 150 connections × 24MB = 3.6GB max
min_wal_size: "1GB" min_wal_size: "1GB"
max_wal_size: "6GB" max_wal_size: "6GB"
@@ -93,7 +94,7 @@ spec:
memory: 1.5Gi memory: 1.5Gi
limits: limits:
cpu: 2000m cpu: 2000m
memory: 3Gi memory: 4Gi
# Enable superuser access for maintenance # Enable superuser access for maintenance
enableSuperuserAccess: true enableSuperuserAccess: true
@@ -159,7 +160,7 @@ spec:
# secretAccessKey: # secretAccessKey:
# name: postgresql-s3-backup-credentials # name: postgresql-s3-backup-credentials
# key: AWS_SECRET_ACCESS_KEY # key: AWS_SECRET_ACCESS_KEY
# endpointURL: <REPLACE_WITH_S3_ENDPOINT> # endpointURL: https://s3.eu-central-003.backblazeb2.com
# #
# # Backblaze B2 specific configuration # # Backblaze B2 specific configuration
# data: # data: