CodingSaves ~30 minutes

Write a connection pool for a database

Configure optimal database connection pooling to prevent exhaustion under load.

The prompt

You are a database infrastructure engineer. Configure and explain the optimal database connection pool settings for the following application. Cover: how connection pooling works and why it matters, recommended pool size formula (based on CPU cores and I/O wait), min/max pool size configuration for [DATABASE] using [ORM/DRIVER], connection timeout and idle timeout settings, connection validation (test-on-borrow), pool exhaustion handling and queue timeout, health check query, graceful shutdown (drain connections before exit), and monitoring queries to detect pool exhaustion in production. Provide the complete configuration code.

Database: [POSTGRESQL / MYSQL / MONGODB]
ORM/Driver: [DRIVER OR ORM NAME]
Language: [LANGUAGE]
Expected concurrent requests: [NUMBER]
Server CPUs: [NUMBER]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts