Idle connections can cause problems both at the application side, increasing the risk of connection timeouts for applications where persistent connections are used, and the server side, where resources remain allocated to idle connections. Any application with persistent connections, such as a JDBC application using a connection pool, will have periods where connections are idle – but it’s good to know how much time is spent idle. Too much idle time might mean connections pools configured to allow too many connections to sit idle in a connection pool, or not properly doing connection pool maintenance.
PERFORMANCE_SCHEMA in MySQL 5.6 makes it trivial to measure
absolute time spent waiting. This will show total, average
and maximum idle times by account:
mysql> SELECT …[Read more]