[Koha-bugs] [Bug 10611] C4::Context->dbh checks if the DB is still running

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Aug 12 15:20:24 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10611

Jonathan Druart <jonathan.druart at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #19765|0                           |1
        is obsolete|                            |

--- Comment #3 from Jonathan Druart <jonathan.druart at biblibre.com> ---
Created attachment 20273
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20273&action=edit
Bug 10611: Use mysql_auto_reconnect instead of ping

DBD::Mysql provides a mysql_auto_reconnect flag. Using it avoid to do a
ping.

Benchmarks:

use Modern::Perl;
use C4::Context;
for ( 1 .. 1000 ) {
    $dbh = C4::Context->dbh;
}

* without this patch on a local DB:
perl t.pl  0,49s user 0,02s system 98% cpu 0,525 total
* without this patch on a remote DB:
perl t.pl  0,52s user 0,05s system 1% cpu 37,358 total
* with this patch on a local DB:
perl t.pl  0,46s user 0,04s system 99% cpu 0,509 total
* with this patch on a remote DB:
perl t.pl  0,49s user 0,02s system 56% cpu 0,892 total

Testing the auto reconnect:
use Modern::Perl;
use C4::Context;
my $ping = $dbh->ping;
say $ping;
$dbh->disconnect;
$ping = $dbh->ping;
say $ping;

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list