Skip to main content

Extreme MySQL CPU Usage

Comments

10 comments

  • 24x7ss
    I will suggest you try optimizing mysql using mysql tunner script. It will help you to optimize mysql settings. I can see that you have set max connection to 3000. If there are not much mysql connection then reduce it and also enable slow query settings on mysql this will help you in optimizing database queries also.
    0
  • Dakado
    There are about 1700-2000 active connections but I cannot really reduce it. 1 connection = 1 connected software and we got 1700 separated softwares running at the time. But I believe that there must be something terribly wrong with my DB because I dont think so some optimalization woud reduce the CPU usage from 500% to 50 for example. 2 weeks ago I have written my own server that works like "cache" and is handling a lot of data and there are about 20 queries per second and the server uses about 0.3% - 1% CPU
    0
  • 24x7ss
    Have you tried enabling slow queries. It will help you to track which database queries are eating up server resources and also try running "watch mysqladmin proc" command on server. This will help you to track the queries/db's which is eating up server resources. Try to optimize database queries. If still you are facing same issue then I will recommend you to go with MariaDB. It is lighter, faster and stable then Mysql. You will see drastic change in performance of site and server.
    0
  • Dakado
    Have you tried enabling slow queries. It will help you to track which database queries are eating up server resources and also try running "watch mysqladmin proc" command on server. This will help you to track the queries/db's which is eating up server resources. Try to optimize database queries. If still you are facing same issue then I will recommend you to go with MariaDB. It is lighter, faster and stable then Mysql. You will see drastic change in performance of site and server.

    WHere should I run that command "watch mysqladmin proc" ? I got Debian and it does not seems to be valid command.
    0
  • ModServ
    What is the output of this script execution?
    wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh sh tuning-primer.sh
    0
  • Dakado
    What is the output of this script execution?
    wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh sh tuning-primer.sh

    Is this script safe ? I have a really really important data in the DB so I dont want to make anything bad to my DB.
    0
  • ModServ
    Sure, it analyses the statistics of MySQL and output the results with tips, read more info here:
    0
  • Dakado
    Sure, it analyses the statistics of MySQL and output the results with tips, read more info here:
    0
  • Dakado
    I have solved the problem by adding keys to my tables to rows like "name" or "user". So it means rows WHERE I am selecting from table.
    0
  • cPanelMichael
    Hello :) I'm happy to see you were able to address the issue. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.