David Fraser
davidf at sjsoft.com
Thu Dec 18 08:24:56 EST 2003
Russell Yanofsky wrote: >Timothy Stebbing wrote: > > >>Is there some way to persist data resource using apache? Im writing a >>simple protocol module >>using PythonConnectionHandler, this takes queries and runs them >>against various backends, >>ie postgres, Lupy (indexer), etc. I want to persist my connections to >>these resources across all >>requests. >> >>Ive tried adding a db 'pool' into a module, but the module is reloaded >>for each request serviced. >> >> > >Is the module containing the db pool the same one that you specified in >PythonConnectionHandler? If so, you should try storing the pool in a >different module and accessing it with an import statement. > > > >>Im wondering if there is some way I can add objects into these 'apache >>tables' ? would that make >>them persistant, and if so how do I do that? I was also wondering if I >>could somehow access the >>main namespace from child interpreters? >> >> > >I doubt Mod_Python is using a different interpreter for each request. It's >probably just reloading the one module. > > It's quite possible that mod_python is using different interpreters for different requests if Apache is loaded with multiple processes. Each process will then have its own interpreter. So if you have 20 interpreters, the likelihood that the first 4 requests each use a unique interpreter is 72.67% This can make it look like each request uses its own interpreter, whereas actually there are a pool of interpreters being shared David
|