mod_wsgi followup

Skip to first unread message

martha alvarez

Sep 1, 2021, 5:24:28 PMSep 1
to modwsgi
I figured out how to get it working but it is not making sense to me intuitively
I basically moved my py file contents to my wsgi file and took out my def application and instead included my connexion and add_api calls directly in it and ended it with instead of a return and it works now:

app = connexion.App(__name__, specification_dir='./')
application =

It loads the amount of processes I have configured in my ssl.conf  (WSGIDaemonProcess ... processes=5) and it does not re-execute the add_api calls over and over after the first 5 requests are executed and those processes are loaded.

Graham Dumpleton

Sep 1, 2021, 5:29:04 PMSep 1
Anything at global scope in the file is run once per process. Anything in the function is run once per request.

If you have multiple processes, then each process has to load it even if defined at global scope, so if lazy loading (default) is used, then you will see that delay as part of the first request time against each process.

You can force preloading of the WSGI script file in the process by using the configuration:

WSGIDaemonProcess mytest user=apache group=apache display-name=me-mytest processes=5
    WSGIScriptAlias /mytest /xxx/bin/mytest.wsgi process-group=mytest application-group=%{GLOBAL}
    <Directory "/xxx/bin">
        Require all granted

That is, set both process-group and application-group on WSGIScriptAlias.

That will trigger the WSGI script file being loaded when the processes first start and not lazily on first request.


You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Reply all
Reply to author
0 new messages