V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
chewuhe
V2EX  ›  Python

python 如何单节点 1s 内生成 10000 个 http 请求?

  •  
  •   chewuhe · 2016-04-23 19:39:37 +08:00 · 5497 次点击
    这是一个创建于 2929 天前的主题,其中的信息可能已经有所发展或是发生改变。
    gevent 生成 1024 个以上就报错了 IOError: cannot watch more than 1024 sockets
    9 条回复    2018-05-29 00:05:39 +08:00
    9hills
        1
    9hills  
       2016-04-23 19:42:38 +08:00 via Android
    这个和 python 无关,关键词 linux fd limit 搜一搜
    chewuhe
        2
    chewuhe  
    OP
       2016-04-23 20:01:19 +08:00
    @9hills windows 上有没有解决办法?
    neoblackcap
        3
    neoblackcap  
       2016-04-23 20:09:33 +08:00
    @chewuhe windows 没有这个 fd 的限制,在 windows 上你操作的 sockets 仅跟你的机器资源有关
    资料来源: https://msdn.microsoft.com/en-us/library/windows/desktop/ms739169(v=vs.85).aspx
    leavic
        4
    leavic  
       2016-04-24 10:08:17 +08:00
    aiohttp?
    chewuhe
        5
    chewuhe  
    OP
       2016-04-24 16:34:42 +08:00
    @neoblackcap 1024 这个限制怎么弄大点呢?有没有办法?
    neoblackcap
        6
    neoblackcap  
       2016-04-24 17:04:05 +08:00
    @chewuhe 都说 windows 没有 fd 的限制,你看看你是不是耗光了内存了。 linux 等 Unix-like 系统才会有 fd 的数量限制,那个我记得是去改在 /etc/ssyctl.conf 里面的 net.core.somaxconn 参数(没有就自己加)
    hasdream
        7
    hasdream  
       2016-04-24 22:43:35 +08:00
    windows 非 Server 版本有并发连接数问题, Server 版没有这个限制
    百度搜 windows 并发连接数
    lbp0200
        8
    lbp0200  
       2016-04-25 01:45:14 +08:00 via Android
    windows 有端口号限制,一个端口需要 4 分钟才能释放
    lifeishort
        9
    lifeishort  
       2018-05-29 00:05:39 +08:00 via iPhone
    @neoblackcap
    事实上 windows 桌面版是有 1024 限制的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2248 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 04:49 · PVG 12:49 · LAX 21:49 · JFK 00:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.