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.

Put limit on CPU available for MySQL

Discussion in 'General Discussion' started by krisdv, Feb 28, 2006.

  1. krisdv

    krisdv Well-Known Member

    Joined:
    Jun 18, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Belgium
    Hi,

    Is there any way like in the my.cnf to limit the %cpu available for MySQL.

    At midnight some crons run for one of our clients and mysql taking all CPU resources.

    Kris
     
  2. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    I have heard you can do that in the latest version of Mysql, but asuming your running a more stable version the only way i can sugest ( if using Linux ) is to edit /etc/security/limits.conf and put a cpu limit on the user. Example:
    Code:
    @fred   hard     cpu         10
     
  3. Mysteerie

    Mysteerie Well-Known Member

    Joined:
    Dec 29, 2003
    Messages:
    129
    Likes Received:
    0
    Trophy Points:
    16
    Am I able to do this to a user, if running under phpsuxec mode? However, a lot of thier connections are via mysql anyway, so I don't think it will matter.

    Also it's a not a huge problem yet, but want to know if it's possible. Probably not going to implement if it is possible. Though what are some of the negative and positive outcomes if possible.
     
  4. kernow

    kernow Well-Known Member

    Joined:
    Jul 23, 2004
    Messages:
    865
    Likes Received:
    9
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    No, you must be root.
     
  5. Mysteerie

    Mysteerie Well-Known Member

    Joined:
    Dec 29, 2003
    Messages:
    129
    Likes Received:
    0
    Trophy Points:
    16
    Maybe I should of worded it better. Yes, I am root. When you run under phpsuexc mode, it displays php files runned under a username instead of as nobody. So putting a resource limit under thier group (i.e. thier php files really), is this possible? Also what would the affects be?
     
  6. krisdv

    krisdv Well-Known Member

    Joined:
    Jun 18, 2003
    Messages:
    175
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Belgium

    How should I read this? User fred will have cpu available for 10 minutes? What happens afterwards? For user i will probably have to put mysql?
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    That's correct for processes running under a specific username:
    http://www.userlocal.com/security/secpam.php

    I don't see how it would work with mysql at all since the processes continually run under the mysql user account and so limiting it will simply keep killing off mysql all the time, possibly leading to database corruption and a ~10 minute wait for chkservd to restart mysql.
     
Loading...

Share This Page