Add:

  WSGIRestrictEmbedded On

to avoid initialising the Python interpreter in every Apache child worker 
process.

Especially since you are using embedded mode with what looks like Apache 
default MPM settings, you are setting yourself up for some pain.

For more details watch:

  http://lanyrd.com/2013/pycon/scdyzk/

Unless you specifically need to have application preloading, instead of:

  WSGIImportScript /xxx/xxx.wsgi process-group=xxx application-group=%{GLOBAL}

use just:

  WSGIImportScript /xxx/xxx.wsgi

The other WSGIProcessGroup/WSGIApplicationGroup directives achieve the same 
thing already, but using the options to WSGIScriptAlias forces preloading.

Indicate to what degree that helps, defining what you mean by 'significant 
time'.

Also try with a WSGI hello world program instead of your real application. Not 
knowing your web application, the issue could well be any preloading your web 
application itself does.

Finally, this looks a bit dodgy:

    WSGIScriptAlias /xxx xxx/xxx/xxx.wsgi
    WSGIScriptAlias /xxx/xxx xxx/xxx.wsgi
    <Directory "xxx/xxx">

You would not usually use relative path names for referring to target WSGI 
script or directory it is contained in. Am not even sure that works properly. 
That you have WSGIProcessGroup inside of the Directory directive may mean it 
isn't even being used properly. So move the WSGIProcessGroup directive to 
outside of the Directory directive.

Graham

On 05/11/2013, at 6:37 PM, Abhishek Anand <[email protected]> 
wrote:

> i'm using python wsgi application for an embedded web ui. i'm loading 
> mod_wsgi dynamically over apache which takes a significant amount of time as 
> compared to other modules. the load is happening at each device boot-up and 
> is causing the boot-up time to slow down. the apache server details are as 
> below --
> 
> Server version: Apache/2.2.21 (Unix)
> Server built:   Sep 11 2012 17:26:04
> Server's Module Magic Number: 20051115:30
> Server loaded:  APR 1.4.5, APR-Util 1.3.12
> Compiled using: APR 1.4.5, APR-Util 1.3.12
> Architecture:   32-bit
> Server MPM:     Prefork
>   threaded:     no
>     forked:     yes (variable process count)
> Server compiled with....
>  -D APACHE_MPM_DIR="server/mpm/prefork"
>  -D APR_HAS_SENDFILE
>  -D APR_HAS_MMAP
>  -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
>  -D APR_USE_SYSVSEM_SERIALIZE
>  -D APR_USE_PTHREAD_SERIALIZE
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>  -D APR_HAS_OTHER_CHILD
>  -D AP_HAVE_RELIABLE_PIPED_LOGS
>  -D DYNAMIC_MODULE_LIMIT=128
>  -D HTTPD_ROOT="XXX"
>  -D SUEXEC_BIN="XXXX"
>  -D DEFAULT_PIDLOG="logs/httpd.pid"
>  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>  -D DEFAULT_LOCKFILE="logs/accept.lock"
>  -D DEFAULT_ERRORLOG="logs/error_log"
>  -D AP_TYPES_CONFIG_FILE="conf/mime.types"
>  -D SERVER_CONFIG_FILE="conf/httpd.conf"
> 
> mod_wsgi uses shared library version of python lib. python version is Python 
> 2.6.2.  
> 
> the conf file details are --
> 
> LoadModule wsgi_module lib/mod_wsgi.so
> 
> LoadFile lib/libXXXX.so
> 
> WSGIRestrictStdout Off
> WSGIRestrictSignal Off
> Listen 8000
> NameVirtualHost *:8000
> <VirtualHost *:8000>
> 
>     DocumentRoot "${EB2}/WebPanel"
>     ErrorLog "/work/log/xxx/httpd_wsgi.log"
>     CustomLog "/work/log/xxx/httpd_wsgi_access.log" common
>     LogLevel Debug
> 
>     WSGIApplicationGroup %{GLOBAL}
>     WSGIPassAuthorization Off
>     WSGIDaemonProcess xxx user=apache group=trusted
>     WSGIScriptAlias /xxx xxx/xxx/xxx.wsgi
>     WSGIScriptAlias /xxx/xxx xxx/xxx.wsgi
>     WSGIImportScript /xxx/xxx.wsgi process-group=xxx 
> application-group=%{GLOBAL}
>     <Directory "xxx/xxx">
>         WSGIProcessGroup xxx
>         Order allow,deny
>         Allow from all
>         Options FollowSymLinks
>         AllowOverride None
>     </Directory>
> 
> <FilesMatch "\.(html|png|css|js)$">
> Header set Cache-Control "max-age=86400"
> </FilesMatch>
> 
> </VirtualHost>
> 
> does mod_wsgi take longer than other modules to load or is there any way to 
> improve the loadmodule time? Please help.
> 
> -- 
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to