Lower MySQL CPU Usage

Discussion in 'Site & Server Administration' started by ska_defender, Dec 16, 2010.

  1. #1
    I'm having a problem with high MySQL CPU usage on my server, Its averaging a load of
    2.5,2.8,3.1

    here is my my.cnf file. is there anything in their that should be changed to help lower the CPU usage?

    Server Specs.
    Many thanks
     
    ska_defender, Dec 16, 2010 IP
  2. underground-stockholm

    underground-stockholm Guest

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Optimize the SQL queries, and add keys if they are missing.
     
    underground-stockholm, Dec 16, 2010 IP
  3. ska_defender

    ska_defender Well-Known Member

    Messages:
    590
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    108
    #3
    How to optimize ??
    Also tell me what is the max load before that I dont have to worry ??
    Is it 20 or 4.0 ?
     
    ska_defender, Dec 16, 2010 IP
  4. sanyi007

    sanyi007 Peon

    Messages:
    189
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well i had load on my site like 8.0-9.0, which was seriously slowed it down. The problem is this: the load means that in that moment, how many processes has to handle the processor. So if the load is 2.0, it means, that it has to handle double the quantity as it can (200%) so it will need more time. Your site will get slower and slower. I believe 2.0-3.0 is not that bad, but the best is if you can stay below 1.0 most of the time. Maybe your site has outgrown your host, or your host is oversold, and thats the reason you has high load. Also you should optimize slow queries if there are any. (just google it, there are lots of tutorials out there for it)
     
    sanyi007, Dec 22, 2010 IP
  5. RHS-Chris

    RHS-Chris Well-Known Member

    Messages:
    1,007
    Likes Received:
    35
    Best Answers:
    10
    Trophy Points:
    150
    #5
    Just to clarify, sanyi007 is somewhat correct. The load number is based upon a single processor. So, if you have a single processor, a load value of 1 would be 100% cpu usage, and anything above that, means that tasks are waiting for processor time. If you have a machine with a multi-cored processor, lets say it has 4, then a value anywhere below 4 would mean that all cores are operating within 100%, so, anything above 4 would mean that processes are waiting.

    Chris
     
    RHS-Chris, Dec 22, 2010 IP
  6. ska_defender

    ska_defender Well-Known Member

    Messages:
    590
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    108
    #6
    Many thanks for your suggestions
     
    ska_defender, Dec 22, 2010 IP
  7. naskin

    naskin Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Can you show results from mysqltuner.com script?
     
    naskin, Dec 24, 2010 IP
  8. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #8
    we can suggest my.cnf parameters after you provide your database and index size.
     
    mwasif, Dec 24, 2010 IP