[mod_python] Communicating between interpreters?

Nicolas Lehuen nicolas.lehuen at gmail.com
Thu Mar 31 02:39:28 EST 2005


On Thu, 31 Mar 2005 09:22:39 +0300, jonk <joni.kahara at gmail.com> wrote:
> On Thu, 31 Mar 2005 07:30:13 +1000, Graham Dumpleton
> <grahamd at dscpl.com.au> wrote:
> 
> Thanks a lot all!
> 
> > What size video are we talking about and what type of throughput on
> > it? Does the server have to handle more than one video stream, or just
> > one?
> 
> Just one video stream right now. This one "master" would grab and
> compress, but these tasks would be delegated to libjpeg etc, so it's
> more about copying data around on the python side. I would expect
> these video frames to be around 15-20 kilobytes each. And it's for our
> web pages (tha place I work for), nothing too serious really.
> 
> > You also may want to clarify how you have Apache setup. Are you
> > intending
> > to run it in standard prefork mode, or are you using a multithreaded MPM
> > which may mean one or more processes? If one using a multithreaded MPM
> > and one process, most of your problems may vanish. If using more than
> 
> Yeah, sorry if I gave too little info. It seems that I am running in forked
> mode, as apache.mpm_query(apache.AP_MPMQ_IS_FORKED) is
> true, and _IS_THREADED is not true. This is how it was pre-configured
> out of box. I'll investigate further.
> 
> 
>     Jonk
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 

If you use the forked MPM, different requests can be handled by
different processes, so the different Python interpreter can't easily
share data. You'll have to resort to inter-process communication
(IPC). You could use sockets or TCP/IP, but if you really need high
performance in sharing high volumes of data, I've heard (but not
tried) that memory-mapped files are the way to go. Check the mmap
module in standard Python, or a higher level module built on mmap,
Vmaps :

http://snafu.freedom.org/Vmaps/Vmaps.html

Regards,

Nicolas


More information about the Mod_python mailing list