Graceful Reloading for Schema Changes - UWSGI - Gunicorn?

99 views
Skip to first unread message

Shapath Neupane

unread,
Apr 16, 2015, 12:36:40 PM4/16/15
to django...@googlegroups.com

Hello Djangonats,

How do you reload Django script changes with UWSGI? I know `touch-reload` exists with UWSGI however I was looking more into what uwsgi does when the schema(s) in the models change? How do you handle database changes without affecting or rebooting the server? Rebooting UWSGI does not sound like a good idea.

A Load Balancer (HAProxy) ?

More Questions

Does something like that exist in Gunicorn?

Regards,

Shapath.

Stephen J. Butler

unread,
Apr 16, 2015, 12:47:10 PM4/16/15
to django...@googlegroups.com
I'm not familiar with uWSGI. On gunicorn you send it SIGHUP (kill -HUP
pid) and it will reload w/o interrupting requests. Looks like uWSGI
supports something similar:

https://uwsgi-docs.readthedocs.org/en/latest/Management.html#signals-for-controlling-uwsgi
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@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/3a98ec4e-d9e2-4bb7-8783-cd97ac7a8acb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Roberto De Ioris

unread,
Apr 17, 2015, 1:54:22 AM4/17/15
to django...@googlegroups.com

>
>
> Hello Djangonats,
>
> How do you reload Django script changes with UWSGI? I know `touch-reload
> <http://uwsgi-docs.readthedocs.org/en/latest/Options.html#touch-reload>`
> exists with UWSGI however I was looking more into what uwsgi does when the
> schema(s) in the models change? How do you handle database changes without
> affecting or rebooting the server? Rebooting UWSGI does not sound like a
> good idea.
>
> A Load Balancer (HAProxy) ?
>
> *More Questions*
>
> Does something like that exist in Gunicorn?
>
> Regards,
>
> Shapath.
>
>

The topic is huge and there are dozens of approaches, but basically every
WSGI server requires a new (updated) process address space after code
change
(included schema changes if the model is already loaded into memory).

So, even if it may look "extreme", reloading the whole WSGI server is the
only reliable solution (in fact used by everyone).

If you are scared about potential downtimes check this article:

http://uwsgi-docs.readthedocs.org/en/latest/articles/TheArtOfGracefulReloading.html

But take in account that 99% of the times/cases a simple graceful reload
is more than enough.


--
Roberto De Ioris
http://unbit.com
Reply all
Reply to author
Forward
0 new messages