CPU usage problem caused by MySQL (PHP)

Discussion in 'MySQL' started by Domino, Jun 26, 2010.

  1. #1
    I received this letter from my hosting...and my account has being suspended...someone has an idea what the cause can be?

    Here is the email received from the hosting...

    Your account was suspended as it was using 70% of the servers CPU usage by your account using MySQL. I'm not sure what exactly you were doing with MySQL to cause this much of a load, but we were forced to suspend the account in order to ensure the stability of the web server.

    We can unsuspend the account as long as you are able to resolve the load issues with your account using MySQL processes.

    The problem started recently, however when we see someone take up 70% of the server cpu resource we suspend the account immediately.

    You will need to review the coding of your site, it could be that a script was being exploited. I can unsuspend your account if you will take action to be sure this doesn't happen again.
     
    Domino, Jun 26, 2010 IP
  2. Layoutzzz

    Layoutzzz Greenhorn

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    18
    #2
    Hi,
    Your script is overflow hosting database server. You should check your script and make optimization of mysql query.
    Also if your script is support cache you should enabled it.
     
    Layoutzzz, Jun 27, 2010 IP
  3. bvsonline

    bvsonline Peon

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    bvsonline, Jun 28, 2010 IP
  4. Michellu

    Michellu Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The fact that the high CPU usage started suddenly and without matching increased web traffic makes me think this isn't an optimization problem but rather a recent mistake you might have slipped in one of your queries or (as the mail suggested) a script being exploited by mal-intented persons. Did you make any recent changes to your scripts prior to being suspended? Look there for the problem.

    But take Layoutzzz's and bvsonline's advices and do enable indexing to your tables, make optimization of MySQL query and enable cache where possible. Even the best written code need optimizations once in a while. MySQL indexes and caching are vital for websites with high traffic or/and large databases. I'm just saying that such a sudden and dramatic change isn't likely to be caused by those problems.
     
    Michellu, Jun 28, 2010 IP
  5. cDc

    cDc Peon

    Messages:
    127
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Echo what has already been said

    also, look for examples where you may be counting lots of rows in innodb tables (requires full table scan) or where you are querying and using functions e.g. WHERE left(myfield,3) = 'abc' this could harm performance. If you dont have many rows in your tables check your application it sounds like you may have some kind of bug perhaps a bad loop or something.
     
    cDc, Jul 13, 2010 IP