in reply to Database Connection Pools with Perl

In general it is difficult to share database connections between processes, or even between perl threads (assuming iThreads, and the older 5.005 threads are broken anyway). So in my opinion the first thing you need to define is how is your SOAP server is going to be implemented.

One thing that you might be able to implement assuming the work load isn't too high is a threaded connection pool server in perl, where you create a number of worker threads that each have a connection, and then use something like Thread::Queue to feed data to the threads. However, given the state of threading support in perl 5.8 I would be a little wary of implementing this in a production environment.

I've written a connection pooling module for Apache/Modperl (Apache::Sybase::ConPool) that works pretty well, but it requires Sybase as the back-end database, and it works because Sybase has one of the few database client APIs that is capable of sharing database connections between processes.

You also mention that you'd like to have each connection stay bound to the session for the duration of the session. This will be difficult to do if by "session" you mean more than a single request, given that such requests aren't guaranteed to be picked up by the same server process (at least under the http protocol), and if the process that handles the request changes, then you've obviously got a different connection for the new request...

Michael

  • Comment on Re: Database Connection Pools with Perl

Replies are listed 'Best First'.
Re^2: Database Connection Pools with Perl
by Anonymous Monk on Oct 15, 2008 at 21:28 UTC
    I am preparing a Orable DB Connection Pool at Apache server startup, which should be available on demand to httpd childs. I have to make sure that there are Maximum possible number of connection at heavy load condition and minimum connection otherwise. I guess I can implement the Connection Pool, but need to know how my httpd child, which is actually php page calling perl scripts are gonna get the connection objects. Any lead would be helpful.
      Orable manual should explains everything, like just appending :POOLED to connect, if you have the right versions of client softwares