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 CPU spikes? are they normal?

Discussion in 'General Discussion' started by madmac, Jan 16, 2004.

  1. madmac

    madmac Well-Known Member

    Jan 11, 2004
    Likes Received:
    Trophy Points:
    on our server (PIV 2GHz, redhat 9, 1GB RAM), when I browse my one website and watch top in shell, mysqld takes up 99.9% of the CPU on some of the queries (sure only for a very brief moment but still, let me continue).

    I have the same website (same coding, same database, same php version, same mysql version) installed locally on OS X here (a 1GHz G4 powerbook), and out of curiosity, I ran my local site and top in terminal as well. under OS X, the same queries that were taking 99.9% CPU on our server, were only taking ~1% CPU , topping off occasionally at ~3-4% CPU.

    Now we just recently got the server, and at the time I ran this test, I am the only one on my server using a site with mySQL. Now I know the OSes here are a bit different, and the CPU arcitecture is far different as well, but surely these 2 system are not so far different that a mySQL query will eat up 99.9% CPU on redHat but only ~1% on my Mac under basically the same conditions??

    Is this normal for mysqld to spike 99.9% CPU on x86 machines and/or OSes? If so then i guess nothing much I can do, though I don't really like it (guess I could pray for the day I can afford an XServe)
  2. seasoned

    seasoned Member

    Jan 25, 2004
    Likes Received:
    Trophy Points:
    fort wayne
    There are a LOT of configuration settings in the system and mysql(and even things like Apache) that can affect this. They are probably different. ALSO, a cache filled with non-relevant data will take MUCH longer, and be more CPU intensive than one with data it can use, or that is empty.

    TWO LARGE TABLES A and B(on a just booted machine withe plenty of cache)

    select * from A (moderate) (load cache while reading)
    select * from B (slow)(manage cache and load while reading)
    select * from A (slow)(")
    select * from A (fast)(select from cache)

  3. haze

    haze Well-Known Member

    Dec 21, 2001
    Likes Received:
    Trophy Points:
    You may want to look into opomizing your my.cnf if you haven't done so already, or if you have, you may want to look into tweaking it a little further. There are other things to look at as well but I'd end up writting a book about it. There are a lot of sources of information out there, just google it up.

Share This Page