Too many connections error
Today we reported that our website was down, the log error was too many connections error, below to investigate the root cause.
My initial suspicion is that max_connections is too small.
Why hasn't this error occurred before? Could it be an increase in business? Or is it Internet ***?
Basic knowledge:
To solve the problem of too many connections, you can start with two parameters:
max_connections and wait_timeout and interactive_timeout
interactive_timeout: The number of seconds the server waits for activity before closing the interactive connection.
wait_timeout: Number of seconds the server waits for activity before closing a non-interactive connection.
These two parameters must be used together. Otherwise, setting wait_timeout alone is invalid
View the maximum number of connections set and the number of connections already used:
show variables like "%max_connection%";
show status like "%used%";
Set the maximum number of connections:
set GLOBAL max_connections=256;(temporary)
max_connections=N in profile modification (permanent)