我在AWS上使用基于CherryPy的服务器处理一些REST API调用。但是在部署服务器并有一些严重的流量(约8小时内大约20万个请求)后,服务器崩溃了。错误日志只显示一种类型的错误。
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在处理过多请求时无法扩展,还是代码有问题?