I always wonder, why does the max_used_connections
value not come down, once it reaches the peak value of max_connections
?
I always flush the status and bring down this value to avoid DB connection refused errors and warning messages in the error log:
=====
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
121112 14:04:36 [Warning] Too many connections
=======
mysql> select version();show variables like "%max_connections%";show global status
like "%Max_used%";show status like "%thread%";
+--------------+
| version() |
+--------------+
| 5.1.52-2-log |
+--------------+
1 row in set (0.00 sec)
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 150 |
+-----------------+-------+
1 row in set (0.00 sec)
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 151 |
+----------------------+-------+
1 row in set (0.00 sec)
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| Com_show_thread_statistics | 0 |
| Delayed_insert_threads | 0 |
| Slow_launch_threads | 0 |
| Threads_cached | 89 |
| Threads_connected | 2 |
| Threads_created | 1344 |
| Threads_running | 2 |
+----------------------------+-------+
7 rows in set (0.00 sec)
mysql> show variables like "%thread_cache%";
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| thread_cache_size | 90 |
+-------------------+-------+
1 row in set (0.00 sec)
Here is the Aborted Connections Status:
mysql> show global status like "%Aborted%";
+------------------+----------+
| Variable_name | Value |
+------------------+----------+
| Aborted_clients | 119 |
| Aborted_connects | 43855304 |
+------------------+----------+
2 rows in set (0.00 sec)
I observed in some scenarios that the
max_used_connections
value comes down dynamically, once thethreads_connected
falls down.Is this only an indication variable to increase the
max_connections
? Posting this query for better understanding. Any detailed explanations please?
I read somewhere thread_cache_size
should be greater than max_connections
, what will be the impact if it is less ?
The maximum number of connections that have been in use simultaneously since the server started.
max_used_connections
solves the problem of too many connections? – Derek Downey Nov 14 '12 at 16:03