Mysql – Unknown source of high number of connections

aws-auroraconnectionsconnectivityMySQLmysql-5.7

In MySQL/Aurora I see from time to time a spike in connections number (from about 100 to 4000):
enter image description here

MySQL doc says:

Connections

The number of connection attempts (successful or not) to the MySQL server.

So I was thinking those coming from failed connection, however I don't see failures:

MySQL [(none)]> SHOW GLOBAL STATUS like 'Conn%';
+-----------------------------------+----------+
| Variable_name                     | Value    |
+-----------------------------------+----------+
| Connection_errors_accept          | 0        |
| Connection_errors_internal        | 0        |
| Connection_errors_max_connections | 0        |
| Connection_errors_peer_address    | 0        |
| Connection_errors_select          | 0        |
| Connection_errors_tcpwrap         | 0        |
| Connections                       | 34388970 |
+-----------------------------------+----------+
7 rows in set (0.00 sec)

MySQL [(none)]> show global variables like '%conn%';
+-----------------------------------------------+-------------------+
| Variable_name                                 | Value             |
+-----------------------------------------------+-------------------+
| aurora_max_connections_limit                  | 16000             |
| connect_timeout                               | 10                |
| disconnect_on_expired_password                | ON                |
| init_connect                                  |                   |
| max_connect_errors                            | 100               |
| max_connections                               | 4000              |
| max_user_connections                          | 0                 |
| performance_schema_session_connect_attrs_size | 512               |
+-----------------------------------------------+-------------------+

I would very much like to understand what those are and when they are coming from.

Best Answer

  • Sounds like a hacker.
  • Based on your graphs, I suggest that max_connections = 4000 is unreasonably high. It looks like 20 might be reasonable.
  • You might want to set max_user_connections to some reasonable value (instead of 0 for "unlimited").