These days I am working on some benchmark testing of Axis2/C. While looking for good tools for the purpose I came across several good candidates. I would like to discuss about some of these tools.
Tools that impressed me and disscussing here are
ab(apache workbench), siege, hammerhead and javabench and http_load. I also tried tsung and curl-loader but could not get it work for me. Here it again prove that however good a software be it does not make appeal to average user if it does not provide a good impression on first try. What most developers expects from a good software is to get them immediately familier with it with some intuitive and working samples. To me it should provide a good <toolname> -h help menu, easy and upto the point samples first. A comprehensive documentations should follow next. tsung seems to be a good performance testing tool that provide a good distributed testing enviroment.
Since my perticular interest is on testing web services one of my main requirement is supporting http POST method. http_load seems to be a good tool but it does not support POST. So I am not discussing it further here.
apache bench
The tool most impressed me is ab(apache bench) that ships with apache2. So naturally it is the tool I selected for my purpose.
ab -k -T “application/soap+xml; charset=UTF-8″ -p data/data.xml -n 1000 -c 32 http://localhost:80/axis2/services/Benchmark > results/result.txt
Here -k indicates whether to use keep-alive feature of http 1.1. You can use -H to add any custom http header you want.
-T options is for giving the content type. Using -p option you can give your data file which contain basically the soap envelope you need to send. Use ab -h to see the meaning of all options.
Following is a result I got after executing the tool
Concurrency Level: 10
Time taken for tests: 0.084 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Keep-Alive requests: 100
Total transferred: 97910 bytes
Total POSTed: 77550
HTML transferred: 76900 bytes
Requests per second: 1195.69 [#/sec] (mean)
Time per request: 8.363 [ms] (mean)
Time per request: 0.836 [ms] (mean, across all concurrent requests)
Transfer rate: 1143.26 [Kbytes/sec] received
905.52 kb/s sent
2048.78 kb/s total
siege
There is a configuration file called siegerc.
siege –rc=./siegerc -H”Content-type: application/soap+xml; charset=UTF-8″ -H”Connection: Keep-Alive”
Almost all ouf your configurations can be put into this configuration file.
Following are some of the options available there
verbose = false
logging = false
protocol = HTTP/1.1
connection = keep-alive
concurrent = 25 #Number of concurrent requests
reps = 1000 #Number of repetitions
file = ./urls.txt
delay = 0 #If you are using for benchmarking value should be 0
benchmark = true
Note the file options above. It indicate to use the urls.txt file in the current folder as the url file. An entry in the urls.txt is as follows.
This entry is for a http POST request
http://localhost:80/axis2/services/Benchmark POST < data/echoDoubles-10.xml
Here is a typical output from siege.
Transactions: 25000 hits
Availability: 100.00 %
Elapsed time: 20.18 secs
Data transferred: 18.33 MB
Response time: 0.01 secs
Transaction rate: 1238.85 trans/sec
Throughput: 0.91 MB/sec
Concurrency: 10.68
Successful transactions: 25000
Failed transactions: 0
Longest transaction: 0.49
Shortest transaction: 0.00
siege is very good tool but to me it seems to be somewhat less capable than apache bench in its sieging capabilities.
hammerhead
hammerhead uses a configuration file and a scenario folder to execute.
hammerhead –conffile=/home/damitha/workspace/apache2_performance/hammerhead/test.conf -s20 -oresults
This tells hammerhead to use test.conf configuration file and run for 20 seconds.
In the test.conf you have an entry like following
Scenario_Directory /home/damitha/workspace/apache2_performance/hammerhead/scn
scn scenario directory can contain any number of .scn files.
An example .scn file is
NSample POST
HContent-type: application/soap+xml; charset=UTF-8
HConnection: Keep-Alive
RPOST /axis2/services/Benchmark
B<soapenv:Envelope xmlns:soapenv=”http://www.w3.org/2003/05/soap-envelope”><soapenv:Header /><soapenv:Body><ns1:echoDoubles xmlns:ns1=”http://www.extreme.indiana.edu/wsdl/Benchmark1″><ns1:input>0.0</ns1:input><ns1:input>1.0</ns1:input></ns1:echoDoubles></soapenv:Body></soapenv:Envelope>
T0
You can think the entries of the .scn file as key value pairs. The first letter in the each line(in block letter) represent the key. rest of the line represent the value. For example B reperesent the http POST message.
Here is sample output file for hammerhead.
Config File : /home/damitha/workspace/apache2_performance/hammerhead/test.conf
Machine : 127.0.0.1:80
: 127.0.0.1:80
: 127.0.0.1:80
: 127.0.0.1:80
: 127.0.0.1:80
: 127.0.0.1:80
: 127.0.0.1:80
Time : Fri Jul 11 11:11:52 2008
SEED = : 1215754872
Parent Process PID = : 12090
Total Run Time (sec) : 20
Sessions : 2
Session Sleep Time (msec) : 0
Startup Lag Time (seconds) : 1
Failures : 0
NoVerify : 0
Total Requests Served : 10
Total Turnaround Time (msec) : 49990
Average Request Time (msec) : 4999
Total Responses : 10
Average Responses / sec : 0.250000
Total Response Time (msec) : 6
Average Response Time (msec) : 0
Scenario Throughput : 10
Sequence Throughput : 12
Run Time (sec) : 40
Scenarios / sec : 0.250000
Sequences / sec : 0.300000
Content Length bytes : 7690
Content Length bytes / sec : 192
Read Length bytes : 7690
Read Length bytes / sec : 192
javabench
javabench is basically apache bench written in java. You can use it in the same way you use apache bench. However it is not as capable sending many requests per second.
You can download a complementary upload of javabench from
http://wso2.org/files/java-bench-0.1.zip
After downloading you can run the tool by using the following script(modify it according to requirement)
Here is the script
for f in ./*.jar
do
JAVABENCH_CLASSPATH=$JAVABENCH_CLASSPATH:$f
done
export JAVABENCH_CLASSPATH
java -classpath $JAVABENCH_CLASSPATH org.apache.http.contrib.benchmark.HttpBenchmark -k -T “application/soap+xml; charset=UTF-8″ -p data/data.xml -n 1000 -c 32 http://localhost:80/axis2/services/Benchmark > results/result.txt
I have been looking for a way to load-test our postgresql servers, so I have tried tsung and so far I am very impressed. Having said that, I was also fortunate enough to attend the 1st Erlang Exchange meeting in London a few weeks ago, where the people who have actually written this stuff staged a tutorial!
Tsung is not meant to be a ‘I shall repeat this POST request one million times per second and see what happens’ tool. One of its strong points is you are able to generate “realistic” testing scenaria, which may be as complex as you like, including parsing results and performing dynamic substitution for subsequent requests.
The easiest way to get started with tsung is to use its “recorder” mode – you may use a tsung process as a proxy, use your browser through this proxy to do everything a user would do and a tsung configuration file is automatically generated for you.
I know things in the open source world sometimes are not as user-friendly as they could be, but tsung is definitely worth another look if you are serious about load-testing with “realistic” test cases.
Michael
Just stumbled upon this entry. I too had the same problem – need to do performance testing against a HTTP endpoint with postfiles. Suprisingly difficult to find a tool that does this well…
I’m in agreement with you, I’ve been using AB for about 3 years now, and its hugely successful. A very good combination of what you want, and simplicity. Easy to setup/configure/modify, good level of statistics, and can effectively pound the crap out of your webserver.
My only gripes with it are:
- unable to support HTTP Digest
- unable to support client-side x509 certificate authentication (does support SSL well with openssl built in).
- no ability to ramp up users and concurrency – its all or nothing.
I’ve been looking at curl-loader as a possible substitute, but it doesn’t seem to do postfiles either (hard to tell though).
[...] 15, 2009 by damitha23 In a previous blog I discussed benchmark testing tools I used for some benchmark perposes. At that time I really used [...]
Hello Damitha,
Let me start by saying that your blogs are very informative and technical. I would love post some questions on SOA/Web Services.
But right now I am trying to bench mark different web servers along with different file systems. I am planning to use ‘ab’ too.
I am planning to send POST requests. Could you please send me a sample POST file you used with -p option. Is there any way I could send upload file request within the POST data file. I am planning to send a HTTP POST request for uploading/downloading static data files which are of different sizes
To answer your first question,
I send a simple hellow message in a post request as follows
ab -T “application/soap+xml; charset=UTF-8″ -p data/input/hello-message.xml -n 5000 -c 60 http://localhost/services/HelloService/ > results/hello-message.txt
My hello-message.xml file is as following
Hello World!
To answer your second question:
Do you want to send file attachements within your soap message?. In this case you need to use base64 encoding or mtom attachements.
thanks,
Damitha