How it works
Bound concurrency
The pool caps simultaneous database work, but callers need a finite acquisition timeout so overload does not create an endless wait.
Size the whole fleet
Per-instance pool size multiplied by the number of application instances must stay within the database connection budget.
Clean borrowed state
Transactions, session variables, temporary tables, and prepared state must be reset before a connection returns to another caller.
Observe saturation
Track active, idle, waiting, timeout, and query-duration metrics to separate pool starvation from slow database work.