mysql 高並發更新計數問題

來源:互聯網
上載者:User

問題:功能為連結的點擊計數,其他兩個計數更新 還有兩個內容表的插入,只插入連結對應的id,分4個庫,共128個表,mysql每天有5000萬次插入和5000萬次更新操作,壓力負載過大,需要想方案,對計數更新做合并處理,或者加cache,一定時間後flush到磁碟DB。

目前有batch處理常式,使用java.sql包原生類,但執行一段後就出現 java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction 錯誤

 

解決進行中,未完成。

解決步驟

show global status like 'Com%' 查詢當前db的crud次數

mysqladmin -htestdb -P3306 -utest -p -S /tmp/mysql.sock -r -i 10 extended-status | egrep "Com_select | Com_insert|Com_update"

統計每十秒的查詢 插入 更新次數

|Com_insert | 5210 |
| Com_insert_select | 0 |
| Com_select | 2033 |
| Com_update | 0 |
| Com_update_multi | 0 |

 

插入時出現 java.sql.BatchUpdateException: The table 'xxx' is full
有說是 tmp_table_size參數和max_heap_table_size參數問題

查看了硬碟發現是硬碟空間不足,100%使用,刪除無用檔案

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.