Opening a connection per request is expensive—PHP-FPM + persistent PDO, ProxySQL, or RDS Proxy pool connections at scale.
PHP perspective
Laravel reuses connections per request lifecycle; avoid creating new PDO in tight loops. Tune max_connections on server vs pool size × app instances.
Too many connections
SHOW STATUS LIKE 'Threads_connected';
SHOW VARIABLES LIKE 'max_connections';
Timeouts
Set wait_timeout and app idle timeouts so leaked connections do not exhaust the server.
Important interview questions and answers
- Q: max_connections exceeded?
A: Too many app servers or leaks—add pooler or fix connection closing. - Q: Persistent PDO?
A: Can reduce handshake cost—watch stale connection handling.
Self-check
- What status shows active connections?
- Why pool at proxy layer?
Tip: Watch Threads_connected vs max_connections during load tests.
Interview prep
- Too many connections?
Scale pooler or reduce per-server connections.
- Threads_connected?
Status variable for open client threads.