#!/usr/bin/perl
# lubenchpress.pl
## lucegene load test -- need multiple queries, results and check the results are same
my $status='http://localhost:7082/lucegene/admin/servletinfo.jsp';
my @qlist= qw{
http://localhost:7082/lucegene/search?q=fbgn-PHM:eye%20AND%20ENZ:kinase&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=fban-ARM:2L%20AND%20BLOC.start:%5B100000%20TO%20200000%5D&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=medline-AbstractText:%22signal%20peptide%22&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=fbgn-all:kinase&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=go-all:development&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=anatomy-all:head&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=bindxml-all:kinase&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=go-SYM:development%20AND%20GN_FB:(Antp%20Abd-B)&method=fetch&headlines=1&format=text/tsv
http://localhost:7082/lucegene/search?q=fbgn-all:eye%20AND%20ENZ:kinase&method=fetch&headlines=1&format=text/tsv
};
print "benchpress test\n";
my $nq= scalar(@qlist);
my $it= 0;
my $nit= 3;
my %size=();
my %ok=();
foreach $it (1..$nit) {
foreach my $i (0..$nq-1) {
my $q= $qlist[$i];
print "($it.$i) curl -s '$q' | wc -c ";
my $v= `curl -s '$q' | wc -c`;
$v =~ s/\s+//g;
$v= int($v);
print "= $v\n";
if ($it==1) { $size{$i}= $v; $ok{$i}++; }
elsif ( $v == $size{$i} ) { $ok{$i}++; }
sleep(10);
}
}
print "benchpress summary\n";
foreach my $i (0..$nq-1) {
print "(sum.$i) ok=",$ok{$i},"/$nit\n";
}
__END__
# $ap/bin/ab -n 30 -c 2 'http://dghome2.local:7082/lucegene/search?q=fbgn-all:eye%20AND%20ENZ:kinase&method=fetch&headlines=1&format=text/tsv'
# $ap/bin/ab -n 30 -c 2 'http://dghome2.local:7082/lucegene/search?q=bindxml-all:kinase&method=fetch&headlines=1&format=text/tsv'
#
#
# ## apache ab does some, but need small diffs in output cleared up .. what ?
#
# dghome2% diff q1 q2
# 55c55
# < of 20788 documents, in 0.028 sec.
# ---
# > of 20788 documents, in 0.031 sec.
# 96c96
# <
# ---
# >
#
# dghome2% $ap/bin/ab
# /bio/biodb/common/servers/apache/bin/ab: wrong number of arguments
# Usage: /bio/biodb/common/servers/apache/bin/ab [options] [http://]hostname[:port]/path
# Options are:
# -n requests Number of requests to perform
# -c concurrency Number of multiple requests to make
# -t timelimit Seconds to max. wait for responses
# -p postfile File containg data to POST
# -T content-type Content-type header for POSTing
# -v verbosity How much troubleshooting info to print
# -w Print out results in HTML tables
# -i Use HEAD instead of GET
# -x attributes String to insert as table attributes
# -y attributes String to insert as tr attributes
# -z attributes String to insert as td or th attributes
# -C attribute Add cookie, eg. 'Apache=1234' (repeatable)
# -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: zop'
# Inserted after all normal header lines. (repeatable)
# -A attribute Add Basic WWW Authentication, the attributes
# are a colon separated username and password.
# -P attribute Add Basic Proxy Authentication, the attributes
# are a colon separated username and password.
# -X proxy:port Proxyserver and port number to use
# -V Print version number and exit
# -k Use HTTP KeepAlive feature
# -d Do not show percentiles served table.
# -S Do not show confidence estimators and warnings.
# -g filename Output collected data to gnuplot format file.
# -e filename Output CSV file with percentages served
# -h Display usage information (this message)
#