通过Nginx-uwsgi-Django的请求非常慢

时间:2014-08-27 12:24:08

标签: python django nginx uwsgi

我认为使用Nginx-uwsgi-Django三元组将比Apache / mod_wsgi组合更好更快,但似乎有些东西不对。当我向Nginx发出常规Web请求并监视uwsgi日志时,我看到了:

[pid: 15529|app: 0|req: 1/1] 172.28.128.1 () {40 vars in 624 bytes} [Wed Aug 27 12:06:23 2014] GET / => generated 1757 bytes in 2262 msecs (HTTP/1.1 200) 2 headers in 73 bytes (1 switches on core 0)

注意这里有2262毫秒的延迟

这是我的uwsgi配置:

[uwsgi]
chdir           = /vagrant/one/main_project

# Django's wsgi file (path starting from chdir/)
#wsgi-file       = /vagrant/one/main_project/main_project/wsgi.py

enable-threads = true

#pythonpath      = /vagrant/one/bin/python2.7

# the virtualenv (full path)
home              = /vagrant/one/


# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe)
socket           = /tmp/uwsgi.sock

# ... with appropriate permissions - may be needed      -
chmod-socket    = 666
# clear environment on exit
vacuum          = true

毕竟,我这样运行:

uwsgi --ini uwsgi_config_one.ini -w main_project.wsgi

它工作正常,但延迟为2262毫秒......为什么会发生这种情况?

0 个答案:

没有答案