> > There isn't. mod_perl and Apache::DBI allow some connection pooling, > but > I'm not sure how it's done. Discussing DBI handles is definitely on > topic. >
mod_perl + Apache::DBI doesn't do connection pooling in Apache 1.3. The way 1.3 works is as follows: Each Apache child has its own perl interpreter with its own memory space. Within that space lives the dbi connection to a server. It's exactly the same as a regular script except for one piece, Apache::DBI. Apache::DBI simply hooks into the DBI connect() method: at any request for a connect, it looks within its memory space for a database handle that already exists of the same name. If it does, it reuses it. If not, it creates one and stores a pointer in its memory space. And as for disconnect(), it basically turns it into a no-op method which does nothing. So in effect, all that happens is reuse of a db handle across requests but within a child (the handles don't die when the request is finished). No concurrency there. For Apache 2.0, it's slightly different: You now have a pool of apache children, a pool of mod_perl interpreters, and a pool of DBI connections. Each having their own parent process that manages the connections to and creations and destructions of children. So here, in effect you're doing pooling across mod_perl processes. >> I assume the proper way of doing it is using a >> messaging mechanism, but there are probably dozens of >> different methods of doing it with caveats for each. >> If anyone has solved this in the past, could you >> provide a snippet of the client and server scripts? > > If you can get it to work, Tim would be very interested to see how. > There > is a lot of magic going on behind the scenes that doesn't react well to > being passed in a message. > I suggest you first look at using the TPI (transaction pooling interface) of the new mod_perl 2.0. You could piggyback on this technology by creating a pool of DBI and accessing it from your threads through the TPI interface. Of course that's all still experimental, and I don't know how much has been written.... Henri. [EMAIL PROTECTED]
