Answer the question
In order to leave comments, you need to log in
Django. Asynchrony: if a long request is made, does the entire server hang with the rest of the users?
Hello. I'm learning django, everything suits until it comes to processing long-running requests (nginx-uwsgi-django bundle). It turns out if the user performs a long request (there is a request to the database), the entire server hangs with the rest of the users. I can’t figure out how to properly organize the server setup, what to pay attention to (threads, processes). Is the only way out (without perversions) to use celery everywhere on long queries. Or use gunicorn (I read there is asynchrony). Thanks for the help.
Answer the question
In order to leave comments, you need to log in
If the question is about manage.py runserver then you are correct.
But this is a debug server that cannot be used in production.
For a combat server, there are different launch options and their parameter settings are different, but in general it comes down to the number of simultaneously processed requests.
The reason why you didn't understand each other with @sim3x is the server killing too long request handlers. Just so as not to exhaust the number of workers processing client requests.
In general, google on the topic of launching wofngo on combat servers. uwsgi, gunicorn etc
How stupid it was. On Friday, I set up several workers, the server was still hanging. Today everything is working, that is, the user is waiting for the report to be generated and others can work with the site. For reliability, I added a couple more threads. Probably forgot to reload the settings. Thanks to those who answered. As I understand it, it will be more correct to wrap lengthy requests in celery.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question