If you are using Apache as your server, you should be using mod_perl v 1.24 or higher and Apache::DBI to provide connection pooling. Simply stated, Apache::DBI will keep a certain number of database connections open and will ignore your connect/disconnect method calls so you won't have to modify your code.

I am not guaranteeing that this will improve things for you, but I think it is fair to say that Apache::DBI is generally perceived to be a performance enhancer.

I have noticed garbage collection issues with the version of Oracle (I know you are using MySQL) in which even though I am explicitely closing my cursors and undefing my $STH's after I am done. In Oracle, there is a way to check and see if you have open cursors after the program has finished executing. Leaving open cursors has catastrophic effects on the performance of your httpd causing it to suck all available CPU and memory and thus bringing your server's performance to its knees. If you are experiencing similar problems, see if there is a way to detect open cursors after your program executes. Also, if you are not already doing so, you should be doing an $STH->finish on every statement handle after you are done using it.

In reply to Re: Disconnecting from a Database by Stegalex
in thread Disconnecting from a Database by fenonn

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.