输入top 看到MySQ经常超过300% 因为是4核
输入mysql -u root -p之后,再输入show full processlist;
看到正在执行的语句
=========================================================
| 4724937 | root | localhost:46676 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=3550 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724941 | root | localhost:46680 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=1281757 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724949 | root | localhost:46688 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=1592172 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724952 | root | localhost:46691 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=1626114 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724954 | root | localhost:46693 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=674111 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724955 | root | localhost:46694 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid` IN (1648229,1648142,1647894,1647737,1647703,1647671,1647611,1647481,1647330,1647265) ORDER BY `tid` DESC LIMIT 0,10 |
| 4724957 | root | localhost:46696 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=151384 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724962 | root | localhost:46701 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid` IN (1648110,1648032,1647948,1647816,1647808,1647800,1647740,1647678,1647605,1647439) ORDER BY `tid` DESC LIMIT 0,10 |
| 4724963 | root | localhost:46702 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=1141261 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724965 | root | localhost:46704 | lplcom | Query | 2 | Waiting for table level lock | SELECT * FROM well_website_thread WHERE `tid`<=1494283 ORDER BY `tid` DESC LIMIT 0,10 |
| 4724966 | root | localhost:46705 | lplcom | Query | 2 | Waiting for table level lock | UPDATE `well_website_thread` SET views=views+1 WHERE tid='862564'
====================================================
请问老大,well_website_thread这个表还有其他优化方式吗?
入库频率太高,1秒5条,还有大量蜘蛛爬内容,导致服务器资源不够用。
1秒5条入库,这已经是5并发了,还要图片本地化,还没算上蜘蛛和正常访问的并发。
采集的朋友一定要注意入库的频率,如果需要图片本地化,还要考虑自己服务器的带宽,对方服务器的速度。
总之量力而行