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
    </Directory>

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.

Graham

> On 2 Sep 2021, at 3:39 am, martha alvarez <[email protected]> wrote:
> 
> 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 application=app.app instead of a return and it works now:
> 
> app = connexion.App(__name__, specification_dir='./')
> app.add_api(...)
> ...
> application = app.app
> 
> 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.
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/e01a31a3-3934-4ef0-a7ef-11cad0437febn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/e01a31a3-3934-4ef0-a7ef-11cad0437febn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/74C14CE8-8CF9-4E0D-BB28-91F7907C4C05%40gmail.com.

Reply via email to