我正在使用Windows Server 2008,Apache 2.2 Python 2.7和Django作为FCGI服务器
FCGI服务器作为SrvAny服务启动:
python c:\amebas_site\amoeba\manage.py runfcgi host=127.0.0.1 port=8881 daemonize=True method=threaded outlog=c:\amebas_site\logs\access.log errlog=c:\amebas_site\logs\error.log maxchildren=100 maxspare=90 minspare=50 maxrequests=10 debug=True
我尝试了不同的maxspare,minspare,maxrequests和maxchildren的值,但没有任何帮助。 在高负载下,我总是得到“500服务器错误”。
Apacheconfiguration:
FastCGIExternalServer c:\amebas_site\fcgi.hook -host 127.0.0.1:8881
RewriteEngine On ... RewriteCond ${REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ /fcgi.hook/$1 [QSA,L]
我的django网站在网上有5-6个用户时效果不错,没有错误。 但是,当我做压力testing(通过loadimpact.com 50个虚拟用户),该网站显示“500内部服务器错误”页面,我在我的apache日志中得到一个错误消息:
[Thu Dec 06 16:29:48 2012] [error] [client 54.246.71.7] (OS 10054)An existing connection was forcibly closed by the remote host. : FastCGI: comm with server "C:/amebas_site/fcgi.hook" aborted: read failed [Thu Dec 06 16:29:48 2012] [error] [client 54.246.71.7] FastCGI: incomplete headers (0 bytes) received from server "C:/amebas_site/fcgi.hook"
但是在Django日志中有注意。 我怎样才能debugging这个问题,摆脱它?
看,你有maxchildren = 100 1.如果你的请求多于1-2秒(可能在调试中),那么你的服务器不能处理所有50个连接2.如果你有静态文件,它由django服务 – 那么它也使用其他连接
解决方案:例如,您可以分析日志并计算5秒钟内有多少个请求