> On 5 Mar 2017, at 7:42 AM, David <[email protected]> wrote:
>
> I've found an issue in heavily increased loading time when mod_wsgi loads the
> application for the first time. This has started since since upgrading from
> my old setup of CentOS 6, Python 2.7.5, Apache 2.2.15, and mod_wsgi 3.4 to my
> new setup of CentOS 7, Python 2.7.13, Apache 2.4.6, and mod_wsgi 4.5.13.
>
> The change has caused the initial loading time of the application into memory
> from ~5 seconds to ~1 minute. I have followed the "Checking Your
> Installation" as much as I could, coming up with a blank as to what could be
> causing this increase.
>
> The mod_wsgi and Apache configuration is the same across both the older and
> new setup, configured to use the worker mpm module running in daemon mode.
> Please find the configuration of both the virtualhost file and the worker
> configuration found in the main httpd.conf file below.
>
> httpd.conf
> <IfModule mpm_worker_module>
> StartServers 16
> MaxClients 250
> MinSpareThreads 10
> MaxSpareThreads 10
> ThreadsPerChild 25
> MaxRequestsPerChild 0
> </IfModule>
>
>
> virtualhost configuration
>
> WSGISocketPrefix run/wsgi
> WSGILazyInitialization On
This is the default, you don't need this directive.
> WSGIRestrictEmbedded Off
You want to set this to On, not Off.
> <VitualHost *:80>
>
> ...
>
> WSGIPassAuthorization On
> WSGIDaemonProcess xxx.com user=django group=admin processes=2 threads=2
> display-name=xxx.com python-path=/srv/django/xxx/lib/python2.7/site-packages
Use:
WSGIDaemonProcess xxx.com user=django group=admin processes=2 threads=2
display-name=xxx.com python-home=/srv/django/xxx
You should not use python-path for setting up a virtual environment, use
python-home instead.
> WSGIProcessGroup xxx.com <http://xxx.com/>
You don't need WSGIProcessGroup if set process-group as option to
WSGIScriptAlias. See below.
> WSGIScriptAlias / /srv/django/xxx/xxx/xxx/wsgi.py
> WSGIImportScript /srv/django/xxx/xxx/xxx/wsgi.py process-group=xxx.com
> application-group=xxx.com <http://xxx.com/>
It is better to use:
WSGIScriptAlias / /srv/django/xxx/xxx/xxx/wsgi.py process-group=xxx.com
application-group=%{GLOBAL}
to force preloading. Remove the WSGIImportScript directive.
> <Directory /srv/django/xxx/xxx/>
> WSGIApplicationGroup xxx.com <http://xxx.com/>
Since you only have the one application and are using daemon mode, you should
use:
WSGIApplicationGroup %{GLOBAL}
But then you don't need this directive at all if you are forcing pre-loading
and have supplied application-group option to WSGIScriptAlias. See above.
> WSGIScriptReloading On
This is the default, you don't need this directive.
> Order allow,deny
> Allow from all
> </Directory>
>
> ...
>
> </VirtualHost>
>
>
> Any help would be greatly appreciated and if anyone can point me in the right
> direction as to how to debug this issue further I will gladly oblige to the
> best of my ability!
Make those changes and see how it goes.
Because you have been force pre-loading, the WSGI application should be getting
loaded when daemon processes start, not on first request.
Graham
--
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 https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.