[mod_python] _really_ Basic concept question

Alex Turner aturner at neteconomist.com
Tue May 13 12:49:18 EST 2003


I would assume that because each request is handled by a different apache
fork the answer would be that you can't just 'share' variable between
instances because apache doesn't share memory (other than shmem).  This is
also assuming you have apache configured to fork not to thread.  I don't 
know if Python has an interface to shmem, but it probably does, and I 
would imagine you could set it up using that.

Of course, I'm new at mod_python and therefore this is my best guest!

Alex Turner
NetEconomist

On Tue, 13 May 2003, rpinder wrote:

> Hi all,
> 
> I'm trying to plan the most efficient way to implement an apache 
> project.  And I have a really basic question about how mod_python (or 
> any apache 'mod 'kind of framework, probably) works.  I think i've read 
> that a major advantage of mod_python is the fact you dont have to 
> re'load the interpreter for each instance... but i'm wondering if this 
> also equates to having a global, accessible, code space that python is 
> operating in.... 
> 
> I'm following the examples in the documentation, and am using the 
> 'handler' example, and have a python script with functions defined that 
> do the work  (there is a database connection happening with an Interbase 
> server). 
> 
> What I"m trying to do is to have a dictionary created and available to 
> all users - without having to re'create the dictionary for each apache 
> visitor.  I have a reason to NOT want to accomplish this using a 
> database table - even though the dictionary is quite large, and requires 
> a lot of overhead each time it's created.
> 
> So my feeble question involves whether or not theres a way to do 
> something like this with modpython, or is it impossible since each 
> instance of the python script gets called in its entirety each time a 
> request comes in from Apache.
> 
> Thanks for any thoughts
> 
> Rich
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list