B
B
badtrips2015-10-22 01:03:01
Django
badtrips, 2015-10-22 01:03:01

What is the correct way to enable lazy-apps option in uwsgi to use fork() in code?

Hi all!
Can anyone tell me what to do with this problem?
I use Debian + Nginx + Django + UWSGI,
in the view one of the functions does a fork (), another process forks, there are no problems with it, after that it immediately follows return render(request, ...
The problem is that after the branch the page does not load immediately, there is a long load and everything ends error "The web page is not available", while if I just update it quickly, it loads normally, since the branch is no longer created (the button on the form is not pressed).
The UWSGI documentation has this -

uWSGI tries to (ab)use the Copy On Write semantics of the fork()call whenever possible. By default it will fork after having loaded your applications to share as much of their memory as possible. If this behavior is undesirable for some reason, use the lazy-appsoption. This will instruct uWSGI to load the applications after each worker's fork(). Beware as there is an older options named lazythat is way more invasive and highly discouraged (it is still here only for backward compatibility)

I don’t fully understand what this is about, but it seems like it’s necessary to use the lazy-apps option in the uWSGI configuration, which I did by writing lazy-apps: 1in my uwsgi.yaml .
This doesn't help, what am I doing wrong?
PS other options than fork () do not suit me yet ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
badtrips, 2015-10-23
@badtrips

Advised to use Celery to solve the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question