0

Recently I observed on one of the production server, many connections are in sleep mode for more than 3 hours or so. I would like to whether we have a way in mysql which if we set, will automatically close these long sleeping connections.

I have given a read like running "flush tables" manually will do this but I want it to happen automatically by mysql. is there solution as such

If i make a script which will connect to mysql and run "flush tables" periodically, does it become a problem in any way...

Thanks in advance...

Deepak Rai
  • 2,163
  • 3
  • 21
  • 36
Uday
  • 1,480
  • 4
  • 27
  • 44
  • Possible Duplicate: http://stackoverflow.com/questions/5026204/how-to-delete-sleep-process-in-mysql – Steve's a D Jul 10 '12 at 12:43
  • Steve. YES there is some similarity but not exact. It sounds we dont have a server variable which keeps monitoring only the sleeping threads. This is the answer I would like to know. Thanks.. – Uday Jul 10 '12 at 12:47

1 Answers1

0

Here is one fine way I found which exactly matches the above criteria.

========================================

Check for sleeping processes and kill them all every 100 seconds:

mk-kill --match-command Sleep --kill --victims all --interval 100

========================================

Uday
  • 1,480
  • 4
  • 27
  • 44