The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mysql wait_time out

Discussion in 'Database Discussions' started by sahostking, Jun 28, 2015.

  1. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    300
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Cape Town, South Africa
    cPanel Access Level:
    Root Administrator
    Hi guys,

    We have a few shared hosting servers and have just been reading up on tuning mysql performance. Shared hosting companies seem to have their wait timeout set to 60 seconds. Is this normal? Do you all follow this amount?

    When I run to check what ours are I get this?

    MariaDB [(none)]> SHOW VARIABLES LIKE 'wait_timeout';
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | wait_timeout | 28800 |
    +---------------+-------+
    1 row in set (0.00 sec)

    Is this possible why one of our servers run out of mysql connections randomly? atleast once a week I notice.

    Thanks
     
  2. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    300
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Cape Town, South Africa
    cPanel Access Level:
    Root Administrator
    I've set it to 60 seconds:

    MariaDB [(none)]> SHOW VARIABLES LIKE 'wait_timeout';
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | wait_timeout | 60 |
    +---------------+-------+

    but I still see this after reloading mysql:

    Id | User | Host | db | Command | Time | State | Info | Progress |
    +------+---------------+-----------+--------------------+---------+------+-------+------------------+----------+
    | 2 | dbname_wp | localhost | dbname_wordpress | Sleep | 84 | | | 0.000

    Shouldn't they be killed at 60 seconds ?
     
  3. 24x7ss

    24x7ss Well-Known Member

    Joined:
    Sep 30, 2014
    Messages:
    271
    Likes Received:
    16
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Did you set the variable "interactive_timeout" as well ? This also affects connections. But I will suggest you to use mysql_close function in your scripts instead of lowering the timeout. Lowering this value to 60 could cause issues to busy websites.
     
  4. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    300
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Cape Town, South Africa
    cPanel Access Level:
    Root Administrator
    It's a shared hosting server. What do you recommend. We had all ours on the default of 28800 so we want to fix this and set it properly but not affect our customer sites. What do your recommend. I noticed some put theirs even at 20s. But we'd rather not go that route. 60 or 120? o r higher?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page