Implement connection pooling
Configure a database connection pool with the right size, timeouts, pool exhaustion handling, and utilisation metrics. Prevents connection starvation under load.
Preview
Copy prompt
Add a connection pool to the [DB] client in a [Language] service that currently opens a new connection per request. Configure min and max pool size based on available CPU cores and concurrency. Set connection acquisition and idle timeout values. Implement graceful pool exhaustion handling so requests queue briefly rather than fail immediately. Add metrics to track active connections, idle connections, and acquisition wait time.
More
Performance
Prompts
