Cherrypy 服务器因请求过多而崩溃
我在 AWS 上使用基于 Cherrypy 的服务器来处理一些 REST API 调用。但在部署服务器时,如果出现一些严重的流量(8 小时内大约 200,000 个请求),服务器就会崩溃。错误日志仅显示一种类型的错误。
ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/wsgiserver/wsgiserver2.py", line 1837, in start
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/wsgiserver/wsgiserver2.py", line 1887, in tick
File "/usr/lib/python2.7/socket.py", line 202, in accept
error: [Errno 24] Too many open files
这是因为如果请求太多,cherrypy 就无法扩展,还是代码中有问题?
I was using a cherrypy based server on AWS to handle some REST API calls. But on deploying the server and with some serious traffic (around 200,000 requests within 8hours) the server wound up. The error log shows only one type of error.
ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/wsgiserver/wsgiserver2.py", line 1837, in start
File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/wsgiserver/wsgiserver2.py", line 1887, in tick
File "/usr/lib/python2.7/socket.py", line 202, in accept
error: [Errno 24] Too many open files
Is this because cherrypy cannot scale if there are too many requests, or is it something wrong in the code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您积压的连接数超出了操作系统配置允许的连接数。尝试检查
ulimit -n
并增加它(如果可以的话)。Sounds like you backlogged more connections than the operating system was configured to allow. Try checking
ulimit -n
and increasing it if you can.