Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Mysql wait_time out

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

  1. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    330
    Likes Received:
    3
    Trophy Points:
    68
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    330
    Likes Received:
    3
    Trophy Points:
    68
    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 ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. sahostking

    sahostking Well-Known Member

    Joined:
    May 15, 2012
    Messages:
    330
    Likes Received:
    3
    Trophy Points:
    68
    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?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Have you considered running a MySQL tuner and seeing if it suggests changing the wait_timeout value?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice