Connection storm (too many connections)
Symptom
'too many connections', 'ORA-00018', 'remaining connection slots reserved' — new connections are being rejected.
1. Measure the current state
How many connections are there, what is the limit, and how many are active vs. idle?
Oracle
SELECT COUNT(*) total, SUM(CASE WHEN status='ACTIVE' THEN 1 ELSE 0 END) active FROM v$session WHERE type='USER';PostgreSQL
SELECT count(*), state FROM pg_stat_activity WHERE backend_type = 'client backend' GROUP BY state;MySQL
SHOW STATUS LIKE 'Threads_connected'; SHOW VARIABLES LIKE 'max_connections';SQL Server
SELECT COUNT(*), status FROM sys.dm_exec_sessions WHERE is_user_process=1 GROUP BY status;Redis
INFO clients2. Identify the source: who/from where
Which application/host/user is opening the connections? Usually a single application server's pool has blown up or there is a connection leak (a pile of idle in transaction sessions).
PostgreSQL
SELECT client_addr, usename, state, count(*) FROM pg_stat_activity WHERE backend_type = 'client backend' GROUP BY 1,2,3 ORDER BY 4 DESC;MySQL
SELECT host, user, count(*) FROM information_schema.processlist GROUP BY host, user ORDER BY 3 DESC;SQL Server
SELECT host_name, program_name, login_name, COUNT(*) FROM sys.dm_exec_sessions WHERE is_user_process=1 GROUP BY host_name, program_name, login_name ORDER BY 4 DESC;3. Buy breathing room immediately
Clean up long-idle/idle-in-transaction connections. If necessary, drop the offending application's connections in bulk. Use the slot reserved for admin login (PG superuser_reserved_connections).
4. The right fix: connection pooling
Raising max_connections without limit consumes memory and only postpones the problem. The right fix is a connection pool on the application side (HikariCP, PgBouncer, ProxySQL) with a reasonable pool size. Pool size is typically around (cores*2 + number of disks) — see the Tools > Connection Pool calculator.
5. Prevent leaks and recurrence
Make sure the application closes connections (finally/using). Set idle_in_transaction_session_timeout and wait_timeout. Set up an alert on connection count.