> Hi, > > At the moment I have following setup: > > A low performance machine with limited RAM > > As web server I use nginx and behind nginx I use uwsgi. > > At the moment nuwsgi is configured to handle ONE django project > with 4 processes. > This django project is rather busy and there should always be processes > ready to handle requests. > > > Now I'd like to add three more django projects to my setup. > > Theseprojects would be rarely used (once per day for a few minutes) and > performance / response times is not that important. > > So ideally these three projects should only be loaded to RAM when the > first request occurs and the memory should be released after some > minutes of inactivity. > > > What would be the recommended uwsgi features / configuration to be used > for such a setup. > > Thanks a lot for some suggestions. >
The are various way: [uwsgi] socket = <your_address> ; start without workers cheap = true ; load the app only on worker spawn lazy = true ; shutdown workers after 60 seconds of inactivity idle = 60 ; load the app module = your_django_app On "idle" such an instance should consume from 2 to 3 megs of RSS memory. You add such a file for each of the "tiny" django app. You can then manage them with the emperor. Another approach (more aggressive as only one process for all of the "tiny" apps is used): [uwsgi] socket = <your_address> ; spawn max 4 workers processes = 4 ; leave 1 worker always running cheaper = 1 ; recycle workers after each request max-requests = 1 You then define the apps in nginx using UWSGI_SCRIPT. At each request the app is loaded in uWSGI and then removed. To avoid much wait during startup, the cheaper mode is used, allowing processes to be started on demand. There are other ways but they requires uWSGI 1.1 -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
