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

2016-04-23 19:39:37 +08:00
 chewuhe
gevent 生成 1024 个以上就报错了 IOError: cannot watch more than 1024 sockets
5521 次点击
所在节点    Python
9 条回复
9hills
2016-04-23 19:42:38 +08:00
这个和 python 无关,关键词 linux fd limit 搜一搜
chewuhe
2016-04-23 20:01:19 +08:00
@9hills windows 上有没有解决办法?
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
2016-04-24 10:08:17 +08:00
aiohttp?
chewuhe
2016-04-24 16:34:42 +08:00
@neoblackcap 1024 这个限制怎么弄大点呢?有没有办法?
neoblackcap
2016-04-24 17:04:05 +08:00
@chewuhe 都说 windows 没有 fd 的限制,你看看你是不是耗光了内存了。 linux 等 Unix-like 系统才会有 fd 的数量限制,那个我记得是去改在 /etc/ssyctl.conf 里面的 net.core.somaxconn 参数(没有就自己加)
hasdream
2016-04-24 22:43:35 +08:00
windows 非 Server 版本有并发连接数问题, Server 版没有这个限制
百度搜 windows 并发连接数
lbp0200
2016-04-25 01:45:14 +08:00
windows 有端口号限制,一个端口需要 4 分钟才能释放
lifeishort
2018-05-29 00:05:39 +08:00
@neoblackcap
事实上 windows 桌面版是有 1024 限制的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/273908

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX