mardi 22 mars 2016

uWSGI worker free, but request' handling has significant delay

I would like to run Django app under uWSGI behind nginx. I've launched 2 uwsgi workers, but I noticed next sad circumstance: when one worker is busy, another worker starts handle request only after 10-15 seconds of waiting.

Configuration is pretty simple.

uWSGI: uwsgi --socket 127.0.0.1:3031 --chdir --wsgi-file wsgi.py --master --processes 2 --threads 1

nginx:

server {
    listen 8000;
    server_name example.org;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3031;
    }
}

and /etc/nginx/nginx.conf - default value

test Django view:

def test(request):
    print('Start!!!')
    time.sleep(9999)
    print('End')
    return HttpResponse()

And wsgi.py has default Django value.

So when I launch all this together and send request then I see in console only one "Start!!!" and only after 10-15 seconds apear second "Start!!!".

I have the same strange behaviour without nginx (with uwsgi --http); with multiple threads for each worker; without "--master" uwsgi option.

Additional info: uwsgi version: 2.0.12 nginx version: 1.4.6 host OS: Ubuntu 14.04 Python version: 3.4 Django: 1.9 CPU: intel i7 (4 cores)



uWSGI worker free, but request' handling has significant delay

Aucun commentaire:

Enregistrer un commentaire