ApacheBench
view release on metacpan or search on metacpan
doc/README.old view on Meta::CPAN
<README for Module Bench>
INSTALL
If your system doesn't have the capability of loading library
dynamically, or should you wish to build a statically-linked
executable on a system which can dynamically load libraries,
run the command "make perl" instead of the usual command
"make".
USAGE
First of all,you need to call constructor,namely new in Bench
to create a "Bench" object (e.g. my $re=Bench->new()).Then you
want to configurate it to make Bench meet your specific need.
There are four recognized parameters:repeat, filesize, priority
and concurrency to allow users to configurate,
where 'repeat' is the default number of requests to make for
each run, 'concurrency' is the concurrency level and 'filesize'
is an default file size to hold the page contents, 'priority' is
either "equal_opportunity" or "run_priority".
Secondly, you need to add a run,which means a group of urls
their correspoding postdata, cookie, filesize, repeat and order.
The postdata is an array reference to a sequence of "big"
postdata strings and cookie is a cookie strings, filesize is a
integer idicating how big the returned file with contents gotten
from the server should be. The default value is 16384 (16k ).
Bench will accordingly ignore or assign empty string/s or take
default value when necessary. To add a run, you call the method
add. The argument of 'add' is a hash reference which accept the
following keys: repeat, postdata , cookie, filesize and order,which
is either "board_first" or "depth_first". (e.g.
$re->add({"urls" => "http://localhost/"}).
After having your desired configuration and runs added, call
$re->execute to perform the requests,
RETURN VALUE
Bench returns a hash reference which has the key for each run,
(keys as "run0", "run1", etc), besides "warn" and "total_time"
and "bytes_received". Each run is again a hash, which has the
keys for each url,besides "thread".
The value stored in the key for each run is again a hash
reference which has the following key/value pairs:
"hostname" => a string of the url's hostname;
"software" => a string of the server software;
"path" => a string of the url's path;
"port" => the port of the server;
"doc_length" => the document length(amount of body read);
"completed_requests" => the requests completed;
"failed_requests" => requests failed;
"total_read" => total amount bytes read from the server;
"page_content" => the whole file read from the server;
"header" => the header from the server;
"max_connect_time" => the max time taken to connect this
server among all our requests;
"min_connect_time" => the min time taken to connect this
server among all our requests;
"max_time" => the max time taken to process and
connect in total among our requests to this url;
"min_time" => the min time taken to process and
connect in total among our requests to this url;
"average_connect_time" => the average time taken to
connect this server for all the requests;
"average_time" => the average time taken to process and
connect this server for all the requests;
if "POST" is used:
"total_posted" => total amount posted to the server;
The value stored in the key "threads" is an array reference which
keeps information for each sequence of requests (that is, visit
each of the urls once in order).
Each entry of the array is a reference to a hash which has the
following key/value pairs:
"total_time" => an array reference, keeps how much time
taken (process and connect) for each url
in order for this thread;
"connect_time" => an array reference,keeps how much time
taken to connect each server in order
for this thread;
"page_content" => an array reference, keeps the contents
read from the servers;
"headers" => an array reference keeping the headers
for every urls in the thread.
The value stored in the key "warn" is a string containing the
warn and error message generated by ab.
The value stored in the key "total_time" is the total time taken
for all our processs and connections in total.
The value stored in the key "bytes_received" is the total bytes
received from all the requests in total.
( run in 0.638 second using v1.01-cache-2.11-cpan-39bf76dae61 )