mysql is constantly over 100% CPU. I've seen it as high as over 500 too strangely. Anyone know the causes of this? What settings I should look at? top - 21:37:18 up 68 days, 11:25, 1 user, load average: 1.07, 1.36, 1.42 Tasks: 226 total, 1 running, 222 sleeping, 0 stopped, 3 zombie Cpu(s): 13.0%us, 12.7%sy, 0.0%ni, 74.2%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 12301588k total, 12137364k used, 164224k free, 1222208k buffers Swap: 2096440k total, 176k used, 2096264k free, 8769200k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9264 mysql 15 0 686m 467m 4108 S 161 3.9 770:09.12 mysqld 12916 nobody 15 0 132m 18m 11m S 7 0.2 0:01.17 httpd 12876 nobody 15 0 129m 18m 10m S 6 0.2 0:01.40 httpd 13011 nobody 15 0 128m 11m 5996 S 6 0.1 0:00.18 httpd 12980 nobody 15 0 128m 16m 10m S 4 0.1 0:01.08 httpd 13014 nobody 15 0 128m 12m 6708 S 3 0.1 0:00.09 httpd 12908 nobody 15 0 130m 17m 11m S 3 0.1 0:00.80 httpd 12915 nobody 15 0 128m 17m 10m S 2 0.1 0:00.80 httpd 12929 nobody 15 0 129m 19m 11m S 2 0.2 0:00.66 httpd 12975 nobody 15 0 128m 14m 8232 S 1 0.1 0:00.38 httpd 12867 nobody 15 0 131m 20m 11m S 1 0.2 0:01.01 httpd 12906 nobody 15 0 130m 19m 11m S 1 0.2 0:01.11 httpd 12977 nobody 15 0 0 0 0 Z 1 0.0 0:00.63 httpd <defunct> 12985 nobody 15 0 128m 16m 10m S 1 0.1 0:00.59 httpd 12818 nobody 16 0 130m 19m 11m S 1 0.2 0:01.43 httpd 12870 nobody 15 0 129m 19m 12m S 1 0.2 0:01.28 httpd Code (markup):
You have quite alot of RAM, which is good. Server load (at this snapshot off top) seems to show that your server load is quite low. Personally, you will need to optimize your MySQL settings. From memory, there was this script that could optimize MySQL for you somewhere at one point. EDIT: Found it! http://mediakey.dk/~cc/optimize-mysql-performance-with-mysqltuner/
what sites are running on your Server? find out which query is eating lot of CPU. log slow queries. try repair table command on all databases. if you are running extensive joints or unions, find how get alternative to those queries. introduce caching of frequently used queries. (tell me RAM / config of your server i will give you my.cnf sample file)
Perhaps you can explain what script do you use and it would be easier to analyze if you post the mysql donfiguration as well
Wow you are using 12 gigs of ram. Hmmm, by any chance are you using apache? I read somewhere that if you set too high of a value for your prefork, it cause the memory to keep going up and up for no reason. Like another person has suggested, I would recommend memcache as a good cache program. Also restarting your mysql should help. You should check the time of day this is happening etc. How often it happens.