MySQL Maxing out CPU!! Please help, URGENT!

Discussion in 'Site & Server Administration' started by nexopedia, May 23, 2008.

  1. #1
    Hey, there seems to be a problem with MySQL, the server has cPanel, and when I view the current CPU usage, this is always being displayed:
    /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/zeus1.forcium.net.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock

    and usually taking up more than 80% of the CPU. Even if I stop the MySQL process (by entering 'service mysql stop') in SSH, it still shows up in the current CPU usage, and even if I try to kill the process with the MySQL service stopped, it keeps coming back.

    Please help as this is taking up a load of CPU and slowing down customer websites. I'm not sure how to fix it.

    Thanks in advance,
    Nexopedia :)
     
    nexopedia, May 23, 2008 IP
  2. msm25

    msm25 Active Member

    Messages:
    502
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Hello,

    Check the connections to the mySQL and try to find who is opening too much connections

    The command is mysqladmin proc stat
     
    msm25, May 23, 2008 IP
  3. nexopedia

    nexopedia Peon

    Messages:
    245
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have, but I have even stopped the MySQL service and it still seems to be running and comes back straight after I've killed the process.

    Thanks,
    Nexopedia :)
     
    nexopedia, May 23, 2008 IP
  4. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #4
    I can optimize your site and db for $100

    50% advance

    Regards

    Alex
     
    kmap, May 23, 2008 IP
  5. msm25

    msm25 Active Member

    Messages:
    502
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #5
    ok, so you know what site is causing this issue? If you suspend that site will you still have the cpu load?
     
    msm25, May 23, 2008 IP
  6. nexopedia

    nexopedia Peon

    Messages:
    245
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I will check now
     
    nexopedia, May 23, 2008 IP
  7. msm25

    msm25 Active Member

    Messages:
    502
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #7
    yes, but remember that you have to restart mySQL after suspending the account, because it not release the mySQL connections
     
    msm25, May 23, 2008 IP
  8. nexopedia

    nexopedia Peon

    Messages:
    245
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #8
    OK, I suspended the account and restarted MySQL, but the CPU load is still quite high (caused by that process)
     
    nexopedia, May 23, 2008 IP
  9. xous

    xous Active Member

    Messages:
    173
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #9
    Could you copy and paste the output of the following commands:

    mysqladmin proc stat

    ps auxf

    Make sure to put the output within code blocks eg. [code] place the code here [/code]
     
    xous, May 23, 2008 IP
  10. lkj

    lkj Peon

    Messages:
    729
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Perhaps you should recreate table indexes and see if it helps. You can also run

    show table status;

    command when you are using particular database and see if it finds any errors in table(s).
     
    lkj, May 30, 2008 IP
  11. nexopedia

    nexopedia Peon

    Messages:
    245
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #11
    It's ok now, we got someone to come and fix it. Running perfectly now :)
     
    nexopedia, May 30, 2008 IP
  12. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #12
    I glad to know that your issue is fixed. I always optimize my.cnf (MySQL configuration file) on the server. Also, I install mytop on cPanel server to see the MySQL resource usage.

    Kailash
     
    kailash, Jun 1, 2008 IP