Thursday, May 1, 2014

Re: problem with django, nginx and gunicorn

Den 01/05/2014 kl. 13.11 skrev 'ReneMarxis' via Django users <django-users@googlegroups.com>:

> Now to my problem... Doing one blocking call to my app, and having only on worker, blocks my entire application.
> In the gunicorn logs (startup) i can see, that gevent is used, but the calls seem to be synchronus.

If your greenlet is not yielding somewhere, then it is in fact worse than standard threads in Python. Due to the GIL, only one thread can effectively run at a time. If your job is very CPU-intensive, then you need to use multiprocessing you make use of the other cores on your multi-core CPU.

> My next problem is, that calls that take longer than 60 seconds lead to an error if i set timeout to 120 inside the gunicorn config (504- Gateway Time-out).

You really shouldn't have requests that take this long. You need to redesign this, e.g. by sending an email to the user with a download URL when the PDF is ready, or by delegating the job to a task server and displaying a status page with some ajax call that polls the progress of your job.

Erik

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/55622D3A-94DC-42DA-8095-9171668F0DE0%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment