View | Details | Raw Unified | Return to bug 6015
Collapse All | Expand All

(-)a/misc/load_testing/benchmark_circulation.pl (-7 / +33 lines)
Lines 11-16 BEGIN { Link Here
11
    eval { require "$FindBin::Bin/kohalib.pl" };
11
    eval { require "$FindBin::Bin/kohalib.pl" };
12
}
12
}
13
13
14
use Getopt::Long;
14
use HTTPD::Bench::ApacheBench;
15
use HTTPD::Bench::ApacheBench;
15
use LWP::UserAgent;
16
use LWP::UserAgent;
16
use Data::Dumper;
17
use Data::Dumper;
Lines 18-28 use HTTP::Cookies; Link Here
18
use C4::Context;
19
use C4::Context;
19
use C4::Debug;
20
use C4::Debug;
20
21
21
my $baseurl= $ARGV[0] || "http://am123/cgi-bin/koha/";
22
my $help;
22
my $max_tries = 200;
23
GetOptions(
24
    'help'    => \$help,
25
);
26
27
if ($help) {
28
    print <<EOF
29
This script runs a benchmark of the staff interface. It benchmark 6 different pages:
30
\t- the staff main page
31
\t- the catalog detail page, with a random biblionumber
32
\t- the patron detail page, with a random borrowernumber
33
\t- the patron search page, searching for "Jean"
34
\t- the patron quick search page, searching for A
35
\t- the circulation itself, doing check-out and check-in of random items to random patrons
36
parameters :
37
\thelp = this screen
38
\tThe 1st parameter must be the URL of the staff interface to query
39
\tThe 2nd parameter must be the login
40
\tThe 3rd parameter must be the password
41
42
SAMPLE : ./benchmark_circulation.pl http://yourstaff.org/cgi/bin/ test test
43
44
EOF
45
;
46
die;
47
}
48
my $baseurl= $ARGV[0] || die "Please run me with --help for needed parameters\n";
49
my $max_tries = 20;
23
my $concurrency = 30;
50
my $concurrency = 30;
24
my $user = $ARGV[1] ||'hdl';
51
my $user = $ARGV[1] || die "Please run me with --help for needed parameters\n";
25
my $password = $ARGV[2] || 'hdl';
52
my $password = $ARGV[2] || die "Please run me with --help for needed parameters\n";
26
53
27
# Authenticate via our handy dandy RESTful services
54
# Authenticate via our handy dandy RESTful services
28
# and grab a cookie
55
# and grab a cookie
Lines 139-145 $ro = $b2->execute; Link Here
139
# calculate hits/sec
166
# calculate hits/sec
140
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
167
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
141
168
142
my $b2 = HTTPD::Bench::ApacheBench->new;
169
$b2 = HTTPD::Bench::ApacheBench->new;
143
$b2->concurrency( $concurrency );
170
$b2->concurrency( $concurrency );
144
print "Load testing patron search page";
171
print "Load testing patron search page";
145
for (my $i=1;$i<=$max_tries;$i++) {
172
for (my $i=1;$i<=$max_tries;$i++) {
Lines 154-160 $ro = $b2->execute; Link Here
154
181
155
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
182
print ("\t".$b2->total_time."ms\t".(1000*$b2->total_requests/$b2->total_time)." borrowers/sec\n");
156
183
157
my $b2 = HTTPD::Bench::ApacheBench->new;
184
$b2 = HTTPD::Bench::ApacheBench->new;
158
$b2->concurrency( $concurrency );
185
$b2->concurrency( $concurrency );
159
186
160
print "Load testing patron search page";
187
print "Load testing patron search page";
161
- 

Return to bug 6015