V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
Zuckonit
V2EX  ›  Python

gevent 内存泄漏?

  •  
  •   Zuckonit · Aug 15, 2014 · 6772 views
    This topic created in 4276 days ago, the information mentioned may be changed or developed.
    最近遇到一个问题, gevent并发开到很大的时候, 时间运行久了, 内存占用飙升, 几个G。 初步猜测是gevent内存泄漏么, google "gevent memory leak" 发现还真有, 没找到可行的解决方案。 请问大家有遇到这个问题的吗?

    gevent 版本 0.13
    7 replies    2014-09-03 12:51:32 +08:00
    mengzhuo
        1
    mengzhuo  
       Aug 16, 2014
    0.13没测过,连接处理完难道没有close?


    -----说个数据-------
    上次压力测试1.0.1
    双核2.3G 4G内存
    简单的echo-add
    60K并发
    100秒内连接/随机发送,
    2个gevent child process共享端口
    19000的rps, 内存保持在160M左右
    Zuckonit
        2
    Zuckonit  
    OP
       Aug 17, 2014
    @mengzhuo 连接处理完没close指的是?
    jander
        3
    jander  
       Aug 20, 2014
    久了是多久?
    我曾经运行24小时,内存占用不变,gevent1.0+python3。
    Zuckonit
        4
    Zuckonit  
    OP
       Aug 21, 2014
    @jander 2个小时的样子, 并发很大, lsof发现很多socket文件被打开, 却没被关闭
    mengzhuo
        5
    mengzhuo  
       Sep 3, 2014
    @Zuckonit

    放码看看,你是不是用了链接池?或者被DDOS?
    Zuckonit
        6
    Zuckonit  
    OP
       Sep 3, 2014
    @mengzhuo 是用了连接池
    mengzhuo
        7
    mengzhuo  
       Sep 3, 2014
    @Zuckonit

    这…… 所以得检查是什么连接过多吧,这和gevent没啥关系,是代码的问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2464 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:05 · PVG 14:05 · LAX 23:05 · JFK 02:05
    ♥ Do have faith in what you're doing.