apache & mod_python

Graham Dumpleton grahamd at dscpl.com.au
Sun Dec 10 16:24:33 EST 2006


m.banaouas wrote:
> thanks for your answers
> The plateform I target is Windows XP (no body is perferct ...).
>
> Concerning multithread , is simultaneous multi http client calls can
> present any problem ? I don't think because usually http server fires a
> different process for each client call, while Threading is discussed
> within the same process, isn't it?

The use of a separate process to handle each request only applies to
the 'prefork' MPM on UNIX systems. Being on Windows, the 'winnt' MPM is
used and concurrent requests are always handled within different
threads within the same Apache process. The referenced article should
have made that clear.

> I'm still looking for mod_python 3.2.10 to install it with apache 2.2.3
> It seems like I must "build" it before use it.
> If there is no other mean I will do it but usually I retrieve "ready to
> use" kits.

See:

  http://nicolas.lehuen.com/download/mod_python/

You will find Python 2.5 versions where whereas the official mod_python
download site only has Python 2.3 and 2.4 versions.

Make sure you grab the appropriate version for your combination of
Apache and Python.

Version 3.2.10 is the last stable version although 3.3.0b is in there
as well and has just been put together for final testing before release
for 3.3.

Graham

> Graham Dumpleton a écrit :
> > Maxim Sloyko wrote:
> >> m.banaouas wrote:
> >>
> >>> Can i install and use  "Apache 2.2.3" & "mod_python 3.2.10" (most recent
> >>> versions) without facing any known major issue ?
> >
> > Only that to use Apache 2.2 you must have mod_python 3.2.10 or later,
> > older versions of mod_python do not work with the more recent version
> > of Apache.
> >
> >> Works fine for me.
> >> The only "known major issue" you can face is general non-threadsafety
> >> of Python interpreter. So, if you are using Apache MPM, you have to
> >> allow for it, or use framework that does it for you.
> >
> > You answer here is a bit misleading. There are no issues with the
> > thread safety of the Python interpreter per-se. However, as with any
> > Python application, whether mod_python is used or not, if multiple
> > threads are being used your application code may have to be written so
> > as to cope with access to code/data from multiple threads at the same
> > time. This is not anything unique to mod_python.
> >
> > Whether this will be an issue or not is dependent on which Apache MPM
> > is used, not that the Apache MPM is used as one will always be used.
> > The specific Apache MPMs where multithreading has to be taken into
> > consideration are "winnt" on Windows platforms and "worker" on UNIX
> > platforms. What this all means is that when these MPMs are used there
> > can be concurrent request handlers executing in distinct threads within
> > the same Apache processes. Thus, where common data is accessed, it has
> > to be adequately protected.
> >
> > For further details on the Apache/mod_python process/interpreter/thread
> > model, see:
> >
> >
> > http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel
> >
> > That said, there are sometimes threading issues with mod_python but it
> > is more to do with the fact that mod_python can use multiple
> > interpreter instances within a single process. Also, the problems are
> > not a problem in mod_python, but result from third party C modules for
> > Python being used which take the simple path of using the simplified
> > thread API for working with the GIL. Such modules often will not work
> > properly when used from secondary Python interpreter instances. In
> > these cases it is a simple matter of telling mod_python to handle
> > requests which are dependent on those modules within the main Python
> > interpreter, ie., the very first one which gets created. Where third
> > party C modules use the full thread API for Python properly, it doesn't
> > matter which interpreter instance they are used from.
> > 
> > Graham
> >




More information about the Python-list mailing list