Hi all, after a lot of thoughts, tests and failures i have committed a
working implementation of "snapshotting".

This is complexity made code, i admit it, but its purpose is to give
sysadmins
a backdoor to save their nights (and avoid calling the developers at 3 AM).

What is a snapshot ?

A snapshot is a worker from the past :) Normally, after a (graceful)
reload, uWSGI will destroy the old workers and will create new ones.

When you enable auto snapshotting (with --auto-snapshot) uWSGI will not
destroy the old workers, but will hybernate them. If after a graceful
reload the most amazing app of the world is destroyed, the sysadmin can
call the old hybernated workers back to life and send to hell the new
(broken) ones.

How to call back the old workers ?

Simply send SIGURG (i think there is no better named signal for this job
;) ) to the master process.

Notes:

snapshots are created only on graceful reloads (SIGHUP). Brutal reload do
not trigger the snapshotting subsystem.

By default your stack will maintain a full copy of all the workers. This
means the double of memory and processes. You can limit the number of
snapshots with:

--auto-snapshot=<n>

where <n> is the number of workers to save.

For example, with --processes=8 and --auto-snapshot=2, after a SIGURG you
will end up with 2 workers. When the developer has fixed the problem,
simply send a SIGHUP and all the workers will came back to life.

Snapshotting will automatically enable the lazy mode:

http://lists.unbit.it/pipermail/uwsgi/2011-May/001912.html


All the snapshot stuff has been only tested (a little) on Linux, so every
report will be very wellcomed.

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to