2

我使用 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 服务器错误”。

阿帕奇配置:

FastCGIExternalServer c:\amebas_site\fcgi.hook -host 127.0.0.1:8881

 RewriteEngine On
 ...
 RewriteCond ${REQUEST_FILENAME} !-f
 RewriteRule ^/(.*)$ /fcgi.hook/$1 [QSA,L]

当有 5-6 个用户在线时,我的 django 网站运行良好,没有错误。但是当我进行压力测试(通过 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 日志中有注释。我怎样才能调试这个问题并摆脱它?

4

1 回答 1

0

Look, you have maxchildren=100 1. If your request is more then 1-2seconds (possible in debug), then your server just couldn't handle all 50 connections 2. If you have static file and it's served by django - then it also uses additional connections

Solution: you could analyse logs and calculate how many requests you have during 5 seconds for example

于 2012-12-06T15:13:03.550 回答