2009/2/10 Graham Dumpleton <[email protected]>:
> 2009/2/10 Ariel Mauricio Nunez Gomez <[email protected]>:
>> I have a server configured like this:
>>
>> <VirtualHost *>
>>     ServerName xx.com
>>     DocumentRoot /home/xx/src
>>
>>     WSGIDaemonProcess xx user=xx group=xx threads=1 processes=25
>> python-path=/home/xx/lib/python2.5/site-packages
>>     WSGIProcessGroup xx
>
> Hmmm, you have come from the pinax group have you?
>
> I already warned in that group that 25 processes was a rather rediculous 
> number.
>
>>     WSGIScriptAlias / /home/xx/deploy/bme.wsgi
>>     ErrorLog /var/log/apache2/error.xx.log
>>     LogLevel warn
>>     CustomLog /var/log/apache2/access.xx.log common
>>     ServerSignature On
>> </VirtualHost>
>>
>> When the server is restarted it starts painfully slow until many =~ 10
>> requests are made, after that speed comes to what's expected.
>>
>> Any ideas on how to troubleshoot that? I tested on two different servers
>> (Debian Etch on a Dell Sever, and Ubuntu Intrepid on an EC2 instance) and
>> experienced the same issue.
>
> You see what you see because application is by default lazy loaded the
> first time request arrives which targets it.
>
> Things are much worse than they need to be in your case because you
> have so many processes needing to load it, so first request that hits
> each process will be slow.
>
> Cut down the number of processes you need. You shouldn't need that
> many even if each is single threaded, unless you have lots of long
> running requests occuring.
>
> You then want to preload the WSGI script file, so at least Python
> modules loaded and ready. Django still lazy initialises itself, but
> haven't worked out recipe yet for people to use to force it to early
> initialise.
>
> Thus use configuration:
>
> WSGIImportScript /home/xx/deploy/bme.wsgi process-group=xx
> application-group=%{GLOBAL}
>
> <VirtualHost *>
>    ServerName xx.com
>    DocumentRoot /home/xx/src
>
>    WSGIDaemonProcess xx user=xx group=xx threads=1 processes=25
> python-path=/home/xx/lib/python2.5/site-packages
>    WSGIProcessGroup xx
>    WSGIApplicationGroup %{GLOBAL}
>
>    WSGIScriptAlias / /home/xx/deploy/bme.wsgi
>    ErrorLog /var/log/apache2/error.xx.log
>    LogLevel warn
>    CustomLog /var/log/apache2/access.xx.log common
>    ServerSignature On
> </VirtualHost>
>
> The two changes are to add WSGIApplicationGroup directive so know
> which interpreter is being used, and to add WSGIImportScript to force
> script to be loaded into that process/interpreter automatically at
> startup of process and not later only when request first arrives.
>
> Right now it is a pain than WSGIImportScript has to be outside of
> VirtualHost. This is fixed for mod_wsgi 3.0 and can be set more
> appropriately inside of VirtualHost, athough must come after the
> WSGIDaemonProcess group directive. This will actually be enforced and
> so when move to mod_wsgi 3.0 in future, configuration file will need
> to be updated. For this latter issue see:
>
>  http://code.google.com/p/modwsgi/issues/detail?id=110

BTW, for forward compatibility with mod_wsgi 3.0 you could also just
move WSGIDaemonProcess outside of VirtualHost.

WSGIDaemonProcess xx user=xx group=xx threads=1 processes=25
python-path=/home/xx/lib/python2.5/site-packages
WSGIImportScript /home/xx/deploy/bme.wsgi process-group=xx
application-group=%{GLOBAL}

<VirtualHost *>
   ServerName xx.com
   DocumentRoot /home/xx/src

   WSGIProcessGroup xx
   WSGIApplicationGroup %{GLOBAL}

   WSGIScriptAlias / /home/xx/deploy/bme.wsgi
   ErrorLog /var/log/apache2/error.xx.log
   LogLevel warn
   CustomLog /var/log/apache2/access.xx.log common
   ServerSignature On
</VirtualHost>

The implication of doing this is technically WSGIProcessGroup could
select that daemon process from another VirtualHost. If your own
system this shouldn't be an issue.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to