G'day all - this is my first post to this list. Hope what I write makes sense...
 
I have a mod_perl 1.29 app running on Apache 1.3.31 - it utilises startup scripts as such:
 
httpd.conf:
<VirtualHost aa.bb.cc.dd>
...
    PerlRequire /var/www/ors/demo/startup.pl
    <Directory /var/www/ors/demo>
        <Files ~ "\.pl$">
            SetHandler perl-script
            PerlHandler Apache::Registry
            PerlSendHeader On
        </Files>
...
    </Directory>
</VirtualHost>
 
startup.pl:
use Apache::DBI;
use Apache::Registry;
use Apache::RegistryLoader;
use DBI;
use DBD::mysql;
 
use strict;
 
Apache::RegistryLoader->new->handler("/roster.pl",
                                     "/var/www/ors/demo/roster.pl",
                                     "demo.localhost");
 
Apache::DBI->connect_on_init('DBI:mysql:rostering_demo:localhost',
                             'username',
                             'password',
                             {  RaiseError => 0,
                                AutoCommit => 1,
                                PrintError => 1 } )
    or die $DBI::errstr;

1;
 
My problem is that I have a growing number of virtual hosts utilising the same application - in different physical directories, but all are exactly the same application for different organisations, running out of different databases. As the number of Apache processes grows to compensate with the server's overall load, the number of open database connections to our MySQL server increases at a ridiculous rate. In the end, people receive "Too many connections" errors from our MySQL server because it has hundreds of open connections and is reaching the limit we've set (and raised time and time again) for it.
 
After doing some reading, I've seen that mod_perl 2 has the capability of supporting shared database handles between Apache threads, but that nothing really has happened with utilising that for DBI as yet.
 
Does anyone else have any ideas as to how I can utilise persistent database connections to a MySQL server via DBI, in order to speed up web queries, but without the 20 or so connections per virtual server that sit there waiting for something to happen? Should I be doing this differently?
 
Thanks in advance.
 
Brett Randall
Network & Systems Engineer
Technology Services Dept
Hillsong Church
www.hillsong.com
Ph 02 8846 4800
 

The material contained in this email may be confidential, and may also be the subject of copyright and/or privileged information. If you are not the intended recipient, any use, disclosure or copying of this document is prohibited. If you have received this document in error, please advise the sender and delete the document.

This email communication does not create or vary any contractual relationship between Hillsong and you. Internet communications are not secure and accordingly Hillsong does not accept any legal liability for the contents of this message.

Please note that neither Hillsong nor the sender accepts any responsibility for viruses and it is your responsibility to scan the email and any attachments.

Hillsong
www.hillsong.com
Hillsong contact details
 

Reply via email to