推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
linkbg
V2EX  ›  Python

如何快速释放 Scrapy 的 Request 的值?

  •  
  •   linkbg · Jun 28, 2017 · 1815 views
    This topic created in 3379 days ago, the information mentioned may be changed or developed.

    之前的问题也发帖请教了,经过一系列的调整,目前能比之前持续时间长,但是还是不能很稳定。时不时还是 OOM 了! 这是 trackref 捕捉的信息:

    >>> prefs()                                                                         
    Live References                                                                     
                                                                                        
    HtmlResponse                       15   oldest: 168s ago                             
    MySuteSpider                        1   oldest: 7484s ago                           
    Request                         11438   oldest: 7319s ago                           
    Selector                           15   oldest: 168s ago
    

    所有的项的值都会降低,但是 Request 这个项,值降低得慢,但是升高得快。所以我想问下,如何能够降低 Request 的值? 谢谢

    2 replies  •  2017-06-29 10:09:18 +08:00
    knightdf
        1
    knightdf  
       Jun 28, 2017
    我每天抓 1000 多 W 条跑了 1 年多了都没触发过 OOM,除了某个版本中代码错误引用导致过,所以这里问题很可能不是在 request 对象数量上,而在你代码中
    不贴代码毫无意义
    leavic
        2
    leavic  
       Jun 29, 2017
    一般来讲,你代码中可能有非异步的东西阻塞了网络,更一般来讲,换条高速网络。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4931 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 09:18 · PVG 17:18 · LAX 02:18 · JFK 05:18
    ♥ Do have faith in what you're doing.