why Threads_connected falls down automatically in some cases How can I monitoring, when Threads_connected increase from which place(files) or when it decrease, because some of cases it dose not fall down automatically in our production server and we are getting to max connection error there, So i need to identify issues in which files has problem,  My site in magento 1.9 and max_connections=151 so i want to know what the ideal count for that and how can i monitoring ?
It sounds like there are a few long queries that lock lots of things, then runs for a while.  Meanwhile, other connections come and try to get at the locked things, but get stalled.

If you are using MyISAM, switch to InnoDB.

Set long_query_time to 1 and turn on the slowlog.  After a while, it will catch the naughty query.  Show us the query, plus SHOW CREATE TABLE for the table(s) that it touches.