Problem Statement
Database connection pools are configured with static max-connection limits. Under varying load, pools either exhaust connections during spikes or waste memory during lulls. Implement an adaptive connection pool health probe that monitors query latency distribution, connection wait times, and pool utilization, then dynamically adjusts max-connections.
Technical Bounds
- Probe interval: 10s
- Min connections: 5, Max: 200
- Adjustment step: +/- 5 per interval
- Latency threshold: p95 < 100ms before scaling down
- Wait threshold: p90 < 50ms before scaling up
- Cooldown: 60s between consecutive same-direction adjustments
Steps
- Create health probe collecting pool metrics
- Implement PID-controller adjustment logic
- Add Prometheus gauges for current/target pool sizes
- Integration test verifying auto-scaling under load spike
Problem Statement
Database connection pools are configured with static max-connection limits. Under varying load, pools either exhaust connections during spikes or waste memory during lulls. Implement an adaptive connection pool health probe that monitors query latency distribution, connection wait times, and pool utilization, then dynamically adjusts max-connections.
Technical Bounds
Steps