我在django中有一个POST API,我已经为应用程序安装了New Relic APM。 django处理请求所需的时间约为250毫秒,但响应时间(从邮递员测量)约为2.5秒。
我的架构是在AWS Elastic Beanstalk上设置的。
负载均衡器(使用SSL)用作Web界面
Linux实例通过WSGI与Django应用程序一起运行Apache
连续请求的响应时间从2.5秒到600毫秒不等。如何识别问题并将响应时间降至500毫秒以下
这是http.d
的wsgi.confLoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On
<VirtualHost *:80>
Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static/>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /opt/python/current/app/test_proj/wsgi.py
WSGIPassAuthorization On
WSGIPassAuthorization On
WSGIPassAuthorization On
<Directory /opt/python/current/app/>
Require all granted
</Directory>
WSGIDaemonProcess wsgi processes=1 threads=15 display-name=%{GROUP} \
python-home=/opt/python/run/venv/ \
python-path=/opt/python/current/app:/opt/python/run/venv/lib64/python3.6/site-packages:/opt/python/run/venv/lib/python3.6/site-packages user=wsgi group=wsgi \
home=/opt/python/current/app
WSGIProcessGroup wsgi
</VirtualHost>
LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined