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

> Thank you Sir. I have few queries on your comments --
> 
> 1. For enabling daemon mode, the conf file contains the required 2 lines, i.e.
> 
> WSGIDaemonProcess xxx user=apache group=trusted
> WSGIProcessGroup xxx
> 
> are these settings incorrect or incomplete?

You do not need to set user and group if those are the same user and group that 
Apache as a whole will run things as, as set by the Apache User and Group 
directives.

> 3. The measurement time is taken as below --
> 
> -- time taken for apache to boot-up without loading mod_wsgi & its conf file
> -- time taken for apache to boot-up with mod_wsgi & its conf file.
> 
> the difference between the 2 times is around 10 sec on 1 Ghz processor with 1 
> GB RAM alongwith other processes booting-up in parallel. So the concern is 
> only the boot-up time.

It doesn't at all sound right. The only extra work that should be required when 
the Apache root process starts up is loading in the mod_wsgi.so and the Python 
shared library it is linked to. Anything else such as Python interpreter 
initialisation would be deferred to child process initialisation, which would 
be done in background and wouldn't delay the actual main Apache startup.

One thing to check though is whether you actually are linked to a Python shared 
library. See:

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library

If you aren't, then when loading mod_wsgi.so, the system loader will need to do 
a lot more extra work as it does local address relocations for the embedded 
static library. That this needs to occur would also mean your application will 
use more memory than it needs to as it doesn't benefit from using a shared 
library.

> 5. Changing Apache to worker MPM may be difficult, but I'll give a try. 

So long as you use WSGIRestrictEmbedded set to On and use mod_wsgi daemon mode, 
the prefork shouldn't really cause any significant additional startup cost.

Graham

> Anything else which I can specify/modify in the conf file to speed up boot 
> time? 
> 
> On Tuesday, November 5, 2013 1:30:18 PM UTC+5:30, Graham Dumpleton wrote:
> 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.

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