關於mysql的cpu佔用高的問題,mysqlcpu佔用高

來源:互聯網
上載者:User

關於mysql的cpu佔用高的問題,mysqlcpu佔用高

現在遊戲開了泰服 ,發現泰服的cpu佔用率總是比繁體或者大陸的高很多,每次都是佔用了300%多

top - 15:34:06 up 222 days,  2:51,  2 users,  load average: 0.75, 0.73, 0.66
Tasks: 215 total,   1 running, 214 sleeping,   0 stopped,   0 zombie
Cpu(s): 52.4%us,  8.5%sy,  0.0%ni, 37.8%id,  1.0%wa,  0.0%hi,  0.3%si,  0.0%st
Mem:  32862732k total, 31396120k used,  1466612k free,   194100k buffers
Swap: 12361720k total,    36232k used, 12325488k free, 29657368k cached


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                                                                                       
 5032 mysql     20   0 8960m 370m 4696 S 494.9  1.2  29146,13 mysqld                                                                                                                                                                       
  386 root      20   0     0    0    0 S  1.7  0.0   4479:15 jbd2/dm-0-8                                                                                                                                                                    
 9208 root      20   0 97084 4076 3012 S  1.7  0.0   0:00.05 sshd                                                                                                                                                                           
 9210 root      20   0 96832 3920 2996 S  1.0  0.0   0:00.03 sshd                                                                                                                                                                           
   58 root      20   0     0    0    0 S  0.3  0.0 938:02.46 kblockd/0                                                                                                                                                                      
   59 root      20   0     0    0    0 S  0.3  0.0 826:25.48 kblockd/1                                                                                                                                                                      
 9207 root      20   0 15172 1420 1008 R  0.3  0.0   0:00.02 top           

但是我的mysql運行是正常的,首先一般最常用的方法就是看mysql的配置


但是我的配置應該也是沒有問題的,所以我mysql等進來看看負載最大的語句是那些:


show processlist;  


尋找負荷最重的 SQL 陳述式,找到了負載大的語句,我發現原來是我的表結構是聯合主鍵,但是沒有設定索引,我於是建立了索引就降下來了。

關於後邊如果還有其他發現,會及時更新到本片文章中



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.