This is a revisiting of the "Killing Bloated Apache Processes" thread
(http://groups.google.com/group/modwsgi/browse_thread/thread/
7f7031d5e158ec56/53a53a71aa0b652b).[1]

I'm picking up the baton from Yishai and thought I'd see if I could
make a little progress on this issue.  As a reminder, we're trying to
use WSGIImportScript to bootstrap our django processes so that there
isn't a substantial delay when they serve their first request.[2]

As per Graham's recommendation, I've done the following:

1. Changed urls.py to import our views
2. Changed our WSGI Script to import both django and our urls file
3. Added WSGIImportScript, WSGIProcessGroup, and WSGIApplicationGroup
directives to our httpd.conf
4. Added a debug log statement to views.py to see when it's loaded.


With this configuration, we definitely see our views.py being loaded
once per process when we start apache.  Which should be fantastic, but
unfortunately it looks like views.py gets loaded AGAIN when we make
our first request to a given process, so we don't see any performance
benefit.

I've verified that our WSGIProcessGroup and WSGIApplicationGroup match
our WSGIImportScript directive, so I'm not sure why this might be
happening.  I've included snippets of relevant config and log files
below.

Any ideas?  As before, we're using Django 0.96+ (r6410) with mod_wsgi
in embedded mode.

Thanks again,
Mike


[1] Google Groups won't allow me to reply to a thread older than 2
months via the web interface, so I'm starting a new post.
[2] The next step will then be to reduce the size of our maximum
requests so that our processes get reset periodically, thereby working
around our problem with growing apache processes (hence the title of
the original thread)


>From httpd.conf:
WSGIProcessGroup %{GLOBAL}
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /usr/local/src/goodrec/djangotest/deploy/django.wsgi
WSGIImportScript /usr/local/src/goodrec/djangotest/deploy/django.wsgi
process-group=%{GLOBAL} application-group=%{GLOBAL}


>From our WSGI Script (django.wsgi):
import os, sys
sys.path.append('.../djangotest')
os.environ['DJANGO_SETTINGS_MODULE'] = 'djangotest.settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/apache/.python-eggs'
import django.core.handlers.wsgi
import django
import urls
import goodrec.views
application = django.core.handlers.wsgi.WSGIHandler()



Apache log snippet during bootup:
[Tue Jan 13 22:30:53 2009] [error] 2009-01-13 22:30:53,926| ALWAYS
|       views.py:122 | Loading views.py
[Tue Jan 13 17:30:54 2009] [info] mod_wsgi (pid=16528): Attach
interpreter ''.
[Tue Jan 13 17:30:54 2009] [info] mod_wsgi (pid=16528, process='',
application=''): Loading WSGI script '.../djangotest/deploy/
django.wsgi'.
[Tue Jan 13 17:30:54 2009] [info] mod_wsgi (pid=16557): Attach
interpreter ''.
[Tue Jan 13 17:30:54 2009] [info] mod_wsgi (pid=16557, process='',
application=''): Loading WSGI script '.../djangotest/deploy/
django.wsgi'.
[Tue Jan 13 17:30:54 2009] [notice] Apache/2.2.9 (Unix) mod_wsgi/2.3
Python/2.5.1 configured -- resuming normal operations
[Tue Jan 13 17:30:54 2009] [info] Server built: Jul 14 2008 15:27:43
[Tue Jan 13 22:30:54 2009] [error] 2009-01-13 22:30:54,785| ALWAYS
|       views.py:122 | Loading views.py


Apache log during first few requests (but not later requests):
[Tue Jan 13 22:31:11 2009] [error] 2009-01-13 22:31:11,532| ALWAYS
|       views.py:122 | Loading views.py


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