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


In reply to Re: Database Connection Pools with Perl by mpeppler
in thread Database Connection Pools with Perl by Tanalis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.