I have configured my Nginx with Django uwsgi.
When the django server starts, it reads a 5MB file from the hard-disk.
Now,
Without Nginx with Django default server
python manage.py runserver
=> Runs immediately and starts serving pages.
Problem:
With Nginx as the server
It takes very long time and several HTTP 504
before it start serving pages.
So, How does uwsgi workers work with Nginx ?
I have:
4 Workers
512 Threads each
So, is the 5MB file getting read 512 * 4 times ?
Is there a possible work around for this in Nginx / Uwsgi ?
Best Answer
A total of 2048 threads ??? Are you sure you have the resources to maintains such a beast ? You will need to heavy tune your kernel too.
By the way if you read the file in the WSGI entry point it will be read only on startup (and then forked()).