On 1 December 2010 21:11, Alessandro Pasotti <[email protected]> wrote:
> 2010/12/1 Graham Dumpleton <[email protected]>
>>
>> On 30 November 2010 19:32, elpaso <[email protected]> wrote:
>> > Hi,
>> >
>> > I need some help debugging a production site with GeoDjango and
>> > mod_wsgi.
>> >
>> > The problem is that a few hours after restart I always end up with 4
>> > processes eating up all available memory, 1 CPU core is 100% kernel
>> > and others are idle, apparently doing nothing.
>> >
>> > I have a traditional setup:
>> > * nginx serving static media + apache + mod_wsgi (latest version)
>> > * GeoDjango (cannot go multithread due to some c/c++ binding libs not
>> > being thread safe)
>> >
>> > this is the configuration:
>> >
>> > ...
>> >    WSGIDaemonProcess ml.eu user=www-data group=www-data processes=10
>> > threads=1 maximum-requests=50 display-name=WSGI
>> >    WSGIProcessGroup ml.eu
>>
>> Your 'ps' output shows a lot more processes than can exist for that
>> daemon process definition.
>
> Thank you for answering, I discovered htop was showing thread in addition to
> processes,  the real number of processes is lower:
>
> ps aux | grep apache|wc -l&&ps aux| grep WSGI|wc -l
> 4
> 11
>
>
>>
>> If you do a complete 'stop' of Apache, do any of the processes still
>> exist? Ie., eliminate whether they are hanging around from an old
>> Apache some how.
>
> Yes, this happened yesterday: stopping apache left a lot of WSGI processes
> alive. I had to kill them by hand.
>
> It seems that after I activated maximum-requests, stopping apache does not
> leave active WSGI processes anymore, I will make some other tests to confirm
> this behaviour.
>
>>
>> Also set:
>>
>>  WSGIApplicationGroup %{GLOBAL}
>>
>> to force use of main interpreter in case GeoDjango doesn't work
>> properly in sub interpreters and is somehow leaking memory.
>>
>> Also ensure not loading mod_python in same Apache.
>>
>> And ensure that not setting DEBUG to True in Django settings module.
>
> I don't have mod_python nor DEBUG activated.
>
> I will follow your suggestions and keep the system monitored.
>
> A last (and probably dumb) question: I cannot understand the how the
> configuration in main apache2.conf <IfModule mpm_prefork_module> section
> interacts with the WSGI* directives in the virtual server config section,
> can you please point me to some docs ? For example: if apache decides to
> activate two servers and processes=10, shall I end up with 20 WSGI processes
> and so on ? Or 10 is a global limit regardless the number of apache
> preforked servers?

The Apache child processes acts as proxies for requests to mod_wsgi
daemon processes. So Apache MPM configuration must allow for more
concurrent requests than the fixed number of mod_wsgi daemon processes
can handle.

The mod_wsgi daemon processes are forked from Apache parent and not
child processes and so what you declare in directive is how many you
get, no more and no less.

BTW, can you use worker MPM instead of prefork MPM or are you stuck
with using it because of PHP being used?

There are some odd process issues that seem only to come up with
prefork MPM, albeit very rare and still not sure of cause yet.

Graham

> Thank you very much for your help!
>
> --
> Alessandro Pasotti
> w3:   www.itopen.it
>
> --
> 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.
>

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