Scrapy:downloader/response_count vs response_received_count

Thi*_*ria 6 python web-crawler scrapy web-scraping

我正在使用scrapy来抓取多个网站,我想分析抓取速度.最后转储的统计信息包含downloader/response_count值和response_received_count值.前者系统地大于后者.

为什么存在差异以及爬虫的哪个元素会增加统计信息收集器中的两个值?

eLR*_*uLL 8

  • CoreStatsExtension负责任的response_received_count
  • DownloaderStatsMiddleware负责任的downloader/response_count.

CoreStats扩展是连接signals.response_received递增值的信号response_received_count,因此它应该计算你得到的每个响应(甚至是坏状态),而DownloaderStats中间件处理特定订单上的响应,正如我们在这里850看到它的顺序,所以以前的Downloader Middlewares(设置的数字低于850可能会丢失甚至得到处理响应的错误,并且downloader/response_count永远不会增加.