Troubleshooting
Database Connection Pooling
Open Mercato relies on PostgreSQL connection pooling to avoid "too many clients" errors. Tune the pool via environment variables to match your deployment footprint.
Pool Configuration
DB_POOL_MIN— Minimum connections in the pool (default:2)DB_POOL_MAX— Maximum connections in the pool (default:10)DB_POOL_IDLE_TIMEOUT— Idle timeout in milliseconds before a connection is released (default:30000)DB_POOL_ACQUIRE_TIMEOUT— Acquire timeout in milliseconds when waiting for a connection (default:60000)
Recommended Settings
Production baseline:
# Adjust according to PostgreSQL max_connections
DB_POOL_MAX=20
DB_POOL_MIN=5
DB_POOL_IDLE_TIMEOUT=30000
DB_POOL_ACQUIRE_TIMEOUT=60000
Local development:
# Smaller pool for local workflows
DB_POOL_MAX=5
DB_POOL_MIN=1
DB_POOL_IDLE_TIMEOUT=10000
DB_POOL_ACQUIRE_TIMEOUT=30000
If you continue to hit connection limits, verify that background workers and migrations use the same pool settings, and confirm that your database max_connections value comfortably exceeds the aggregate pool size across all applications connecting to it.