<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 9/8/10 4:54 PM, Simon Miner wrote:
    <blockquote
      cite="mid:AANLkTim3tx1trYS59p2Kbs1aQZ5Ht2uMA=UCgj0-2_ug@mail.gmail.com"
      type="cite">Thanks for the responses,<br>
      <br>
      Jason, I don't think reducing the number of database connections
      will hurt responsiveness.&nbsp; Even though there are 3 separate
      Catalyst apps, each HTTP request will only involve one of them
      (since they all run out of the same web server), so there should
      never be contention between the apps for the shared database
      connection.&nbsp; Does this make sense?<br>
      <br>
      Tom and Nicholas, I wish this was premature optimization, but my
      organization has experienced serious performance issues in the
      past related to multiple (Oracle) database connections per HTTP
      server process.&nbsp; Extra Oracle connections are expensive to
      maintain, particularly on the database server, and so we've tried
      to ensure that a single server process only has a single
      connection to a given database (since that's all it should need at
      any given time).<br>
      <br>
      I've attached a Devel::NYTProf screenshot for one of the server
      processes I profiled this morning. Looks like it confirms the
      multiple database connections.<br>
      <br>
      So back to initial question -- How do I update the models of my
      three Catalyst apps to share a single Oracle database connection?<br>
    </blockquote>
    Sounds like a job for Apache::DBI -- it will cache one connection
    per process and hand it over to the next app that requests it as
    long as it's valid -- but keep in mind that the connection
    attributes MUST be the same for all three Catalyst apps for the
    magic to happen. From the perldoc:<br>
    <br>
    <blockquote type="cite">The parameters defining the connection have
      to be exactly the same, including the connect attributes! If there
      is no appropriate database handle or if the ping method fails, a
      new connection is established and the handle is stored for later
      re-use.</blockquote>
    I agree that this is not early optimization -- just good
    housekeeping. Oracle SQL Net connections are indeed expensive to set
    up but tend to consume near-zero resources when idle, so I would not
    worry too much about connection reuse among apps just yet - in my
    book this is more of a sysadmin issue.<br>
    <br>
    <blockquote
      cite="mid:AANLkTim3tx1trYS59p2Kbs1aQZ5Ht2uMA=UCgj0-2_ug@mail.gmail.com"
      type="cite">
      <br>
      Thanks again.&nbsp; I really appreciate your feedback.<br>
      <br>
      &nbsp;Simon<br>
    </blockquote>
    Hope this helps,<br>
    <br>
    -Javier Arturo Rodriguez<br>
    <br>
    <blockquote
      cite="mid:AANLkTim3tx1trYS59p2Kbs1aQZ5Ht2uMA=UCgj0-2_ug@mail.gmail.com"
      type="cite"><br>
      <div class="gmail_quote">On Tue, Sep 7, 2010 at 11:40 PM, Nicholas
        Wehr <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:catalyst@bionikchickens.com">catalyst@bionikchickens.com</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">I'm with Tom on this one. Unless you've
          narrowed all optimization efforts and this is all you have
          left - it could be worth a try.. but as Jason points out, you
          may not gain a thing. I'd recommend profiling your code and
          tracking down performance issues from that base level. Please
          post your results - I've very curious!<br>
          <font color="#888888">
            <br>
            -nw</font>
          <div>
            <div class="h5"><br>
              <br>
              <div class="gmail_quote">On Tue, Sep 7, 2010 at 7:21 PM,
                Tomas Doran <span dir="ltr">&lt;<a
                    moz-do-not-send="true"
                    href="mailto:bobtfish@bobtfish.net" target="_blank">bobtfish@bobtfish.net</a>&gt;</span>
                wrote:<br>
                <blockquote class="gmail_quote" style="margin: 0pt 0pt
                  0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
                  padding-left: 1ex;">
                  <div><br>
                    On 7 Sep 2010, at 18:59, Simon Miner wrote:<br>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;">
                      All three of these apps run under a single Apache
                      1.3.42/mod_perl 1.31 server.<br>
                    </blockquote>
                    <br>
                  </div>
                  Wow, mod_perl 1.... Ok then :)
                  <div><br>
                    <br>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;">
                      &nbsp;It appears that each server process creates a
                      unique database connection variable for each of
                      these apps. Although these database connections
                      get reused from request to request, I would like
                      to make things even more efficient by having a
                      single database connection variable per server
                      process which gets shared across all 3 Catalyst
                      apps.<br>
                    </blockquote>
                    <br>
                  </div>
                  Why do you think that this will help or affect
                  anything?<br>
                  <br>
                  I.e. is this not premature optimisation?<br>
                  <br>
                  Cheers<br>
                  t0m
                  <div>
                    <div><br>
                      <br>
                      <br>
                      _______________________________________________<br>
                      List: <a moz-do-not-send="true"
                        href="mailto:Catalyst@lists.scsys.co.uk"
                        target="_blank">Catalyst@lists.scsys.co.uk</a><br>
                      Listinfo: <a moz-do-not-send="true"
                        href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
                        target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
                      Searchable archive: <a moz-do-not-send="true"
                        href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
                        target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
                      Dev site: <a moz-do-not-send="true"
                        href="http://dev.catalyst.perl.org/"
                        target="_blank">http://dev.catalyst.perl.org/</a><br>
                    </div>
                  </div>
                </blockquote>
              </div>
              <br>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          List: <a moz-do-not-send="true"
            href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>
          Listinfo: <a moz-do-not-send="true"
            href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
            target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
          Searchable archive: <a moz-do-not-send="true"
            href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
            target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
          Dev site: <a moz-do-not-send="true"
            href="http://dev.catalyst.perl.org/" target="_blank">http://dev.catalyst.perl.org/</a><br>
          <br>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      -- Simon<br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
List: <a class="moz-txt-link-abbreviated" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext" href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext" href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>