MySQL process goes over 100% of CPU usage
Solution 1:
- Increase Key Buffer ( yours is currently 64MB, but total indexes are 116M, so put at least 128MB). Should help immediately.
- Run mysqloptimize and mysqlrepair on your tables
- Increase table cache/ decrease total number of tables to increase the table cache hit rate. Maybe you've got some unused or old tables which could be deleted.
Other recommended confugration options:
- log_slow_queries = /var/log/mysql/mysql-slow.log
- long_query_time = 4
- log-queries-not-using-indexes
Check log file after some time.
Solution 2:
You have a processor which has more than one core, or you have multiple processors. If you have two cores and a process is using 100% of both cores, it will show as 200% in top.
Likewise, this is likely working as intended -- nothing is wrong with your configuration. If you are experiencing frequent hangs, from what you posted, you may want to look into adding proper indexes to your tables (or optimizing your queries).
Solution 3:
Run top -H
to see all the running threads and not just the overall process. Also, if you hit the 1
key while in top, it will show you the cpu usage for the individual CPUs/cores.