Cherrypy 服务器因请求过多而崩溃

发布于 2024-12-14 07:50:13 字数 608 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

翻身的咸鱼 2024-12-21 07:50:13

听起来您积压的连接数超出了操作系统配置允许的连接数。尝试检查 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文