2012/6/24 Roberto De Ioris <[email protected]> > > > I use uwsgi+nginx to run my django app. And encountered a serious > problem. > > uwsgi config ini file: > > > > [api_pro] > > processes=4 > > module=wsgi > > chmod-socket=1 > > master=1 > > buffer-size=65535 > > chdir=/home/venti/prod/webapps/ > > pythonpath=/home/venti/prod/ > > socket=/tmp/uwsgi_api_pro.sock > > env=DJANGO_SETTINGS_MODULE=webapps.settings_api_server > > > > As you can see, I use 4 processes because I have 4 cpu cores, But when a > > user upload an photo. > > > This is a common wrong assumption, the number of cpus is unrelated with > the number of processes needed for your app. Just as an example, apache by > default will spawn upto 256 processes and tomcat starts with dozens of > threads. Each app has different requirements. Tools like uwsgitop or > services like newrelic can help in finding the best values. >
Thanks you, I know this principle, I'm check out he uwsgitop later. > > > The server will get blocked and other light requestes can not be > > processed, > > this looks very strange, are you sure you are not trying from the same > browser ? In such a case it would not be able to send datas to the > webserver (you can try using a second browser or tools like curl) > > Actually, it's not me testing this on a web browser, It's my users who uploading photos. I can find this problem through the uwsgi log file. when processing a slow upload request, the server get blocked. And after the upload request is finished, therer will be a bunch of GET request logs come out with a "IO write error" because the user has closed the request already. It's very strange that uwsgi not using the other 3 processes. I enabled the thread mode with adding this two lines. threads=40 enable-threads=1 The problem seems gone now, very strange problem, isn't it? > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
