meti-backend/config/db_optimized.yaml
Aditya Siregar e1a5e9efd3 add users
2025-08-15 22:17:01 +07:00

41 lines
1.2 KiB
YAML

# Optimized Database Configuration for handling 1000+ users
database:
host: localhost
port: 5432
db: meti_vote
driver: postgres
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
ssl-mode: disable
debug: false
# Connection Pool Settings - Optimized for high load
# For 1000+ concurrent users, these settings help manage database connections efficiently
# Maximum number of idle connections in the pool
# Keeping more idle connections reduces connection setup overhead
max-idle-connections-in-second: 25
# Maximum number of open connections to the database
# This prevents overwhelming the database with too many connections
max-open-connections-in-second: 100
# Maximum lifetime of a connection in seconds (30 minutes)
# This helps prevent stale connections and memory leaks
connection-max-life-time-in-second: 1800
# Additional PostgreSQL tuning recommendations:
#
# In postgresql.conf:
# - max_connections = 200
# - shared_buffers = 256MB
# - effective_cache_size = 1GB
# - work_mem = 4MB
# - maintenance_work_mem = 64MB
# - checkpoint_completion_target = 0.9
# - wal_buffers = 16MB
# - default_statistics_target = 100
# - random_page_cost = 1.1
# - effective_io_concurrency = 200
# - min_wal_size = 1GB
# - max_wal_size = 4GB