MySql sleep's

Discussion in 'Site & Server Administration' started by Aceday, Jul 2, 2007.

  1. #1
    My Mysql seems to keep regularly crashing due to many processes being opened and staying in sleep for 600+ seconds and not closing.
    Anyone know how i can get it to close these sleep processes after 600 seconds ?
     
    Aceday, Jul 2, 2007 IP
  2. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well sleeping processes would be coming from people making persistent connections. So in your my.cnf you could do something like mysql.allow_persistent=Off . As for a way to make them time out after x amount of seconds I'm unsure on there's timeout or in mysql5 connect-timeout. But I'm unsure if that works on persistent connections.
     
    InFloW, Jul 3, 2007 IP
  3. stugs

    stugs Peon

    Messages:
    157
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sleeping processes are usually caused by your code not properly closing connections.

    To lower the timeout edit your my.cnf and add/change "wait_timeout=600"

    For most of my applications I set this to ~120 seconds.
     
    stugs, Jul 3, 2007 IP