2009/11/29 andres <[email protected]>:
> Pylons attaches an "environment" dictionary to each request which
> contains server information, http headers and other request specific
> data:
>
> http://pylonsbook.com/en/1.1/exploring-pylons.html#exploring-the-environment
>
> OK, so it sounds like it's not a problem to run a multiprocess,
> multithread mod_wsgi Daemon process.

No, there is no problem with that. There isn't much stuff around that
particularly cares if things are multiprocess. The only ones that come
to mind are debugging tools which work on expectation that requests
always come back to same process. They need this to be the case as
they retain state in process memory about where debugging session is
up to.

> I have another question...
>
> I'm using mod_wsgi daemon mode to serve dynamic content and apache to
> serve static files. The following is a sample of the messages in my
> error log:
>
> [Sat Nov 28 12:24:46 2009] [info] mod_wsgi (pid=21989): Terminating
> Python.
> [Sat Nov 28 12:26:06 2009] [info] mod_wsgi (pid=22179): Attach
> interpreter ''.
> [Sat Nov 28 12:26:31 2009] [info] mod_wsgi (pid=21964): Cleanup
> interpreter ''.
> [Sat Nov 28 12:26:31 2009] [info] mod_wsgi (pid=21964): Terminating
> Python.
> [Sat Nov 28 12:26:36 2009] [info] mod_wsgi (pid=22182): Attach
> interpreter ''.
> [Sat Nov 28 12:31:34 2009] [info] mod_wsgi (pid=22205): Attach
> interpreter ''.
> [Sat Nov 28 12:32:11 2009] [info] mod_wsgi (pid=22208): Attach
> interpreter ''.
>
> What do these messages mean? I thought that mod_wsgi in daemon mode
> did not add python interpreters to apache server instances. Are these
> error messages from the apache processes that proxy information to and
> from the mod_wsgi daemon mode processes?

First off, they are not error messages. They are information messages
logged at 'info' log level. They are output to help in understanding
what Apache/mod_wsgi is doing when things aren't working as you
expect.

As described in:

  http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html

Prior to mod_wsgi 3.0, the Python interpreter was always initialised
in Apache parent process.

That this was the case was largely dictated by what mod_python used to
do. That is, had to be able to coexist with mod_python and actually
had to defer to it when both loaded and allow it to initialise Python
interpreter even though it resulted in some loss of functionality in
mod_wsgi.

Consequence of this is that an initialised main Python interpreter was
inherited by all child processes of Apache parent process. This
includes both Apache server child processes and mod_wsgi daemon
processes.

The message:

[Sat Nov 28 12:26:06 2009] [info] mod_wsgi (pid=22179): Attach
interpreter ''.

is just indicating a bit of housekeeping done by mod_wsgi in any child
process whereby it registers that main Python interpreter instance
inherited from Apache parent process, into mod_wsgi's Python
interpreter lookup table.

There is a bit of FUD around that having Python embedded in Apache in
this way is evil and will cause all requests to Apache be affected
performance wise. That is utter garbage.

Although the Python interpreter may be sitting there initialised and
taking a small amount of memory, it is never invoked in any way in the
normal flow of handling requests for static files or requests against
modules support other languages, such as PHP.

The Python interpreter would only ever be used if a request URL mapped
to a Python web application.

Anyway, that blog post I reference explains how in mod_wsgi 3.0 things
have been changed and what the problems were with the prior way of
doing things.

Graham

> -Andres
>
>
>
> On Nov 28, 3:04 pm, Graham Dumpleton <[email protected]>
> wrote:
>> What do you mean by 'Pylons environment'?
>>
>> Seems that something in Pylons or your application has added it as
>> debug or an indicator of something based on underlying
>> wsgi.multithread/wsgi.multiprocess flags in WSGI environment. The
>> mod_wsgi module itself doesn't add such a string.
>>
>> For more about those underlying flags read:
>>
>> http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading
>>
>> If it is not your application, you may need to ask the Pylons folks
>> why/how it gets there.
>>
>> Graham
>>
>> 2009/11/29 andres <[email protected]>:
>>
>>
>>
>> > Hi,
>>
>> > I'm using mod_wsgi in daemon mode with multiple processes and multiple
>> > threads as shown in this example:
>>
>> >http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDae...
>>
>> > Everything seems to be working properly but I found the following
>> > message inserted into the pylons environment:
>>
>> > wsgi process: "Multi process AND threads (?)"
>>
>> > Does this mean there something wrong with my configuration?
>>
>> > -Andres
>>
>> > --
>>
>> > 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 
>> > athttp://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.
>
>
>

--

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