MySQL
MySQL too many connections
Overview
What does this alert mean?
Connection count exceeds 80% of max_connections. New connections may be refused with 'Too many connections'.
Contributing factors
- Connection leak — connections not returned to pool
- Slow queries holding connections open longer than expected
- max_connections set too low for the current workload
Affected components
- Application services opening new connections
- Connection pool managers
Expected action
Identify and kill long-running or idle connections. If the issue is persistent, increase max_connections or deploy a connection pooler.
Services
- MySQLhttps://dev.mysql.com/doc/Team: Fill in: owning team name
Metrics
Metric
mysql_global_status_threads_connected / mysql_global_variables_max_connectionsDescription & unit
Ratio of current connected threads to the configured maximum. Exported by mysqld_exporter.
Unit: ratio (0–1), alert threshold at 0.8
Threshold rationale
At 80% of max_connections, there is still headroom to investigate before connections are refused. At 100%, new connections fail immediately.
Normal behavior
Typically stays below 50% in healthy operation. Spikes during deploys or traffic bursts are normal but should recover within minutes.
Screenshots


Alert Behavior
Silencing
Silence during load tests or planned traffic migration events.
Expected frequency
Occasional — may fire during traffic spikes or after a deploy that causes connection leaks.
Severities
Severity guidance
Warning severity. Escalate to critical if connections reach 95%+ or new connection errors appear in application logs.
Impacted users
Users of any service that opens new database connections.
Things to check to determine severity
- Are application error logs showing 'Too many connections'?
- Was there a recent deploy?
- Is a specific host or service responsible for the spike?
Verification
Prometheus query
mysql_global_status_threads_connected / mysql_global_variables_max_connections > 0.8Dashboards
- MySQL Connections — Fill in: dashboard URL
Log queries
- Application connection errors — Fill in: log query URL
Troubleshooting
Steps
- 1Check current thread count:
SHOW STATUS LIKE 'Threads_connected'; - 2Identify who is connected:
SHOW PROCESSLIST; - 3Find long-running queries:
SELECT * FROM information_schema.processlist WHERE time > 30 ORDER BY time DESC; - 4Kill a blocking query if safe:
KILL QUERY; - 5Check configured maximum:
SHOW VARIABLES LIKE 'max_connections'; - 6Increase temporarily if needed:
SET GLOBAL max_connections = 500;— also update my.cnf for persistence
Useful commands
SHOW STATUS LIKE 'Threads_connected';SHOW PROCESSLIST;SELECT * FROM information_schema.processlist WHERE time > 30 ORDER BY time DESC;Possible Resolutions
Connection leak after a deploy — rolling restart of the application cleared stale connections.
Dependencies
- Application connection pools
- ProxySQL or MySQL Router (if in use)
Escalation
Guidance
Escalate if connections exceed 95% or if application errors are visible to end users.
Slack channels
- #database-oncall — Fill in: channel URL
Definitions
Alert rule
Fill in: link to the alert rule in _data/rules.yml on GitHubTuning notes
The 80% threshold is a ratio of the configured max_connections — it is self-normalizing. Only adjust if your application tolerates a higher saturation level.
Related Links
Related alerts
Documentation
Template adapted from https://runbooks.gitlab.com/template-alert-playbook/