mongodb - Python写的爬虫出现了规律性暂停
大家讲道理
大家讲道理 2017-04-17 17:13:15
0
1
551

8核8g服务器

数据是存储在mongoDB中 大概三百万的数据

爬虫每次获取一万条开始爬行

每爬行完成一条便 update status

创建了进程池 大概两百进程 当任务队列不足十分之一(1w)便从mongoDb中抽取十万条数据 保持不空闲

正常速度应该是 update 20/s insert 130/s

刚开始运行时很正常 mongostat 监控的数据和程序记录的速度一致

但是运行二十分钟后 mongostat 的记录 update 40/s insert 60/s 程序的记录 变得很低

这个过程保持五分中后 一切又恢复原状了。。。速度正常 反复如此

mongoDB的日志看不出任何问题 插入一条100ms 读取一万条 600ms 更新一条 200ms

有经验的朋友帮忙分析下导致这种情况的可能

找原因都快疯掉了。。

拜谢

程序记录的速度

mongostat 正常的速度

mongostat 不正常的速度

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
黄舟

I found the problem. I didn’t know there was a queue module before, but there was a problem with a queue I implemented. . . Ashamed

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!