Bugzilla – Attachment 3558 Details for
Bug 6015
Enhancing the performance test suite
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
0001-Bug-6015-Improving-load_testing.patch (text/plain), 6.84 KB, created by
Chris Cormack
on 2011-03-30 22:30:53 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-03-30 22:30:53 UTC
Size:
6.84 KB
patch
obsolete
>From ba89c7e519e2fc78027e14f4573aa6d05f637861 Mon Sep 17 00:00:00 2001 >From: Henri-Damien LAURENT <henridamien.laurent@biblibre.com> >Date: Thu, 25 Mar 2010 11:37:19 +0100 >Subject: [PATCH] Bug 6015 : Improving load_testing > >Adding a benchmark for OPAC >it tests : > - mainpage > - search page > - detail page > >Staff : >Adding a test on member searches >--- > misc/load_testing/benchmark_circulation.pl | 39 ++++++++- > misc/load_testing/benchmark_opac.pl | 128 ++++++++++++++++++++++++++++ > 2 files changed, 162 insertions(+), 5 deletions(-) > create mode 100755 misc/load_testing/benchmark_opac.pl > >diff --git a/misc/load_testing/benchmark_circulation.pl b/misc/load_testing/benchmark_circulation.pl >index 8974edb..5a5f90d 100755 >--- a/misc/load_testing/benchmark_circulation.pl >+++ b/misc/load_testing/benchmark_circulation.pl >@@ -16,13 +16,13 @@ use LWP::UserAgent; > use Data::Dumper; > use HTTP::Cookies; > use C4::Context; >+use C4::Debug; > >-my $baseurl= C4::Context->preference("staffClientBaseURL")."/cgi-bin/koha/"; >+my $baseurl= $ARGV[0] || "http://am123/cgi-bin/koha/"; > my $max_tries = 200; >-my $concurrency = 10; >-my $debug; >-my $user = 'kados'; >-my $password = 'kados'; >+my $concurrency = 30; >+my $user = $ARGV[1] ||'hdl'; >+my $password = $ARGV[2] || 'hdl'; > > # Authenticate via our handy dandy RESTful services > # and grab a cookie >@@ -37,6 +37,7 @@ if( $resp->is_success ) { > print "Authentication successful\n"; > print "Auth:\n $resp->content" if $debug; > } >+ > # remove some unnecessary garbage from the cookie > $cookie =~ s/ path_spec; discard; version=0//; > $cookie =~ s/Set-Cookie3: //; >@@ -138,7 +139,35 @@ $ro = $b2->execute; > # calculate hits/sec > print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n"); > >+my $b2 = HTTPD::Bench::ApacheBench->new; >+$b2->concurrency( $concurrency ); >+print "Load testing patron search page"; >+for (my $i=1;$i<=$max_tries;$i++) { >+# print "$baseurl/members/moremember.pl?borrowernumber=$rand_borrowernumber\n"; >+ push @borrowers,"$baseurl/members/member.pl?member=jean"; >+} >+$b2->add_run($run2); >+$b->add_run($run2); >+ >+# send HTTP request sequences to server and time responses >+$ro = $b2->execute; >+ >+print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n"); > >+my $b2 = HTTPD::Bench::ApacheBench->new; >+$b2->concurrency( $concurrency ); >+ >+print "Load testing patron search page"; >+for (my $i=1;$i<=$max_tries;$i++) { >+# print "$baseurl/members/moremember.pl?borrowernumber=$rand_borrowernumber\n"; >+ push @borrowers,"$baseurl/members/member.pl?quicksearch=1&surname=A"; >+} >+$b2->add_run($run2); >+$b->add_run($run2); >+ >+# send HTTP request sequences to server and time responses >+$ro = $b2->execute; >+print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n"); > # > # issue (& then return) books > # >diff --git a/misc/load_testing/benchmark_opac.pl b/misc/load_testing/benchmark_opac.pl >new file mode 100755 >index 0000000..1284805 >--- /dev/null >+++ b/misc/load_testing/benchmark_opac.pl >@@ -0,0 +1,128 @@ >+#!/usr/bin/perl >+# This script implements a basic benchmarking and regression testing >+# utility for Koha >+ >+use strict; >+use warnings; >+BEGIN { >+ # find Koha's Perl modules >+ # test carefully before changing this >+ use FindBin; >+ eval { require "$FindBin::Bin/kohalib.pl" }; >+} >+ >+use HTTPD::Bench::ApacheBench; >+use LWP::UserAgent; >+use Data::Dumper; >+use HTTP::Cookies; >+use C4::Context; >+use C4::Debug; >+ >+my $baseurl= $ARGV[0] || "http://am123/cgi-bin/koha/"; >+my $max_tries = 200; >+my $concurrency = 30; >+my $user = $ARGV[1] ||'hdl'; >+my $password = $ARGV[2] || 'hdl'; >+ >+# Authenticate via our handy dandy RESTful services >+# and grab a cookie >+my $ua = LWP::UserAgent->new(); >+# Get some data to work with >+my $dbh=C4::Context->dbh(); >+my $sth = $dbh->prepare("select max(borrowernumber) from borrowers"); >+$sth->execute; >+my ($borrowernumber_max) = $sth->fetchrow; >+ >+$sth = $dbh->prepare("select max(biblionumber) from biblio"); >+$sth->execute; >+my ($biblionumber_max) = $sth->fetchrow; >+ >+$sth = $dbh->prepare("select max(itemnumber) from items"); >+$sth->execute; >+my ($itemnumber_max) = $sth->fetchrow; >+ >+$|=1; >+# >+# the global benchmark we do at the end... >+# >+my $b = HTTPD::Bench::ApacheBench->new; >+$b->concurrency( $concurrency ); >+# >+# mainpage : (very) low RDBMS dependency >+# >+my $b0 = HTTPD::Bench::ApacheBench->new; >+$b0->concurrency( $concurrency ); >+ >+my @mainpage; >+print "--------------\n"; >+print "Koha circulation benchmarking utility\n"; >+print "--------------\n"; >+print "Benchmarking with $max_tries occurences of each operation and $concurrency concurrent sessions \n"; >+print "Load testing opac client main page"; >+for (my $i=1;$i<=$max_tries;$i++) { >+ push @mainpage,"$baseurl/opac-main.pl"; >+} >+my $run0 = HTTPD::Bench::ApacheBench::Run->new >+ ({ urls => \@mainpage, >+ }); >+$b0->add_run($run0); >+$b->add_run($run0); >+ >+# send HTTP request sequences to server and time responses >+my $ro = $b0->execute; >+# calculate hits/sec >+print ("\t".$b0->total_time."ms\t".(1000*$b0->total_requests/$b0->total_time)." pages/sec\n"); >+print "ALERT : ".$b0->total_responses_failed." failures\n" if $b0->total_responses_failed; >+ >+# >+# biblios >+# >+my $b1 = HTTPD::Bench::ApacheBench->new; >+$b1->concurrency( $concurrency ); >+ >+my @biblios; >+print "Load testing catalog detail page"; >+for (my $i=1;$i<=$max_tries;$i++) { >+ my $rand_biblionumber = int(rand($biblionumber_max)+1); >+ push @biblios,"$baseurl/opac-detail.pl?biblionumber=$rand_biblionumber"; >+} >+my $run1 = HTTPD::Bench::ApacheBench::Run->new >+ ({ urls => \@biblios, >+ }); >+$b1->add_run($run1); >+$b->add_run($run1); >+ >+# send HTTP request sequences to server and time responses >+$ro = $b1->execute; >+# calculate hits/sec >+print ("\t".$b1->total_time."ms\t".(1000*$b1->total_requests/$b1->total_time)." biblios/sec\n"); >+print "ALERT : ".$b1->total_responses_failed." failures\n" if $b1->total_responses_failed; >+ >+# >+# borrowers >+# >+my $b2 = HTTPD::Bench::ApacheBench->new; >+$b2->concurrency( $concurrency ); >+ >+my @borrowers; >+print "Load testing search page"; >+for (my $i=1;$i<=$max_tries;$i++) { >+# print "$baseurl/members/moremember.pl?borrowernumber=$rand_borrowernumber\n"; >+ push @borrowers,"$baseurl/opac-search.pl?idx=ti&q=Code"; >+ push @borrowers,"$baseurl/opac-search.pl?idx=au&q=Jean"; >+ push @borrowers,"$baseurl/opac-search.pl?idx=su&q=Droit"; >+} >+my $run2 = HTTPD::Bench::ApacheBench::Run->new >+ ({ urls => \@borrowers, >+ }); >+$b2->add_run($run2); >+$b->add_run($run2); >+ >+# send HTTP request sequences to server and time responses >+$ro = $b2->execute; >+# calculate hits/sec >+print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." searches/sec\n"); >+ >+print "Load testing all transactions at once"; >+$ro = $b->execute; >+print ("\t".$b->total_time."ms\t".(1000*$b->total_requests/$b->total_time)." operations/sec\n"); >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6015
:
3558
|
6410
|
6418
|
6419
|
6542