`
老汉学编程
  • 浏览: 30818 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

selenium驱动firefox抓取网页数据,在firefox内存优化和速度优化方面的努力

阅读更多

使用默认frofile,启动firefox  内存600M,几个小时之后彪到一个G。

禁用掉图片,缓存  启动内存200M左右,但是几个小时之后内存彪到600M左右.

 

目前查到的优化项,正在努力中&尝试中......,

各种尝试如果都不行,目前想到的终极解决方案:爬取一定量的页面之后关闭当前线程对应的firefox窗口,开启新窗口!

profile.setPreference("permissions.default.image", 2);
//禁用浏览器缓存
profile.setPreference("network.http.use-cache", false);
profile.setPreference("browser.cache.memory.enable", false);
profile.setPreference("browser.cache.disk.enable", false);
profile.setPreference("browser.sessionhistory.max_total_viewers", 3);
profile.setPreference("network.dns.disableIPv6", true);
profile.setPreference("Content.notify.interval", 750000);
profile.setPreference("content.notify.backoffcount", 3);
                   
//有的网站支持   有的不支持
profile.setPreference("network.http.pipelining", true);
profile.setPreference("network.http.proxy.pipelining", true);
profile.setPreference("network.http.pipelining.maxrequests", 32);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics