I have a monitoring app that checks MySQL's Threads_connected and Max_used_connections variables every X seconds.

Neither of these variables tells me what I want to know: The highest number of concurrent connections since the last check (X seconds ago).

In the past, I've used FLUSH STATUS to reset Max_used_connections some time after the critical level is reached, but this method isn't ideal for a number of reasons, and according to the docs:

This is something you should use only when debugging a query.

Before I head down the path of a complicated analysis of the query log, is there anything I'm overlooking?


The only thing I can think of is finding some what (maybe through a cron job) to record the 'Threads_connected' values every minute, and then calculate the max of these values.

I'm not sure if you can do exactly what you are asking for without resetting the 'Max_used_connections' before your monitoring period.

  • Thanks for the answer Dave. I am tracking Threads_connected every 5 minutes, and that does alert me to serious trouble. I just wish I could see that value over time... Running a cron on the target system is out of the question. – xofer Oct 4 '11 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.