[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
Fri Sep 20 07:29:06 CEST 2013


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

Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> changed:

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

--- Comment #7 from Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> ---
Created attachment 21264
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21264&action=edit
[SIGNED-OFF] 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;

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>
Comment: Real improvement. No koha-qa errors

prove t/db_dependent/Circulation_issuingrules.t produces no error
t/db_dependent/Circulation_issuingrules.t .. ok
All tests successful.

Test:
run twice sample script with more iterations
first local, then remote

1) without patch
a) local
real    0m2.461s
user    0m0.848s
sys     0m1.052s
b) local
real    0m2.427s
user    0m1.072s
sys     0m0.852s

2) with patch
a) local
real    0m0.213s
user    0m0.196s
sys     0m0.012s
b) local
real    0m0.208s
user    0m0.200s
sys     0m0.008s

3) without patch
a) remote
real    0m14.957s
user    0m2.048s
sys     0m2.012s
b) remote
real    0m15.472s
user    0m1.816s
sys     0m2.728s

4) with patch
a) remote
real    0m0.221s
user    0m0.208s
sys     0m0.012s
b) remote
real    0m0.216s
user    0m0.192s
sys     0m0.020s

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


More information about the Koha-bugs mailing list