Django 网站在重新启动或不活动一段时间后加载速度非常慢
我正在 Apache 上运行 Django 站点,在一段时间不活动(大约 1 小时)后,初始页面加载速度非常慢。我可以通过离开一个小时或跳出服务器来进行复制。初始加载后,页面加载一致 << 1秒。
我假设(猜测)问题是 Python 解释器 + Python 模块在这些不活动期之后再次加载到内存中?
我关注了 http://blog .dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html 并在守护进程模式下运行 mod_wsgi。
服务器配置:
Timeout 20
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ServerLimit 10
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 4
MaxRequestsPerChild 0
</IfModule>
...
WSGIDaemonProcess django display-name=%{GROUP}
WSGIScriptAlias / /path/to/osqa.wsgi process-group=django application-group=%{GLOBAL}
上面的配置是否明显有问题,或者有没有办法将Python解释器保留在内存中?
也许这是一个完全不同的问题?
谢谢
I'm running a Django site on Apache, and am experiencing very slow intial page loads after a period of inactivity (about 1 hour). I can replicate by leaving for an hour, or bouncing the server. After the initial load, pages load consistently in < 1 sec.
I'm assuming (guessing) the issue is the Python interpreter + Python modules are being loaded into memory again after these periods of inactivity?
I've followed http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html and am running mod_wsgi in daemon mode.
Server config:
Timeout 20
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
ServerLimit 10
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 2
MaxSpareServers 2
MaxClients 4
MaxRequestsPerChild 0
</IfModule>
...
WSGIDaemonProcess django display-name=%{GROUP}
WSGIScriptAlias / /path/to/osqa.wsgi process-group=django application-group=%{GLOBAL}
Is something obviously wrong with the config above, or is there a way to keep the Python interpreter in memory?
Perhaps this a different issue altogether?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些想法:
A few ideas: