3
Using WebHammer
This chapter provides an overview of how to use the WebHammer utility. It includes the following sections:
WebHammer Syntax
WebHammer includes the hammer command.
The hammer command runs a workload on a Web server. It simulates multiple users carrying out different operations on a Web site.
The scenario file contains a list of URL operations that are performed on the Web site. In order to use the hammer command, you must have a scenario file that specifies the workload run on the Web site using the hammer command. Comments are not allowed in a scenario file. Each operation in a scenario file must start in column one.
Multi-level trace is supported and is useful when establishing a workload or when troubleshooting is required.
For more information on multi-level trace, see Using Trace.
Synopsis
The following is the hammer command syntax:
hammer [-f] [-R] [-h] [-V] [-c] [-t throughput] [-n urls] [-u users] [-l
localhost] [-r remote] [-p port] [-v level] [-o log_file] [scenario_file]
Options
WebHammer supports the options listed in the following table:
Operands
There is one operand supported by the hammer command.
A scenario_file is the path name of a file containing the workload. If the file specified is not found, a diagnostic message is output on standard error.
The default name for the scenario file is scenario. It is located in the current working directory.
Hammer Command Examples
The following are examples of the hammer command:
example% hammer -u 5 -p 8080 -r 196.168.1.105 -o log scenario1
This shows a workload with 5 users (-u 5) run on a Web server listening on port 8080 on a system with the IP address 196.168.1.105. The results are output to log and the workload is read from scenario1
example% hammer -u 10 -p 8080 -r asc6 -o log scenario1
This shows a workload with 10 users (-u 10) run on a Web server listening on port 8080 on a system called asc6. The results are output to log and the workload is read from scenario1
example% hammer -u 1 -v 1 -p 8080 -r asc6 scenario1
This shows a workload with 1 user (-u 1) run on a Web server listening on port 8080 on a system called asc6. The workload is read from scenario1. Level 1 trace (-v 1) is used in order to validate the response from the Web server.
example% hammer -u 10 -t 200 -p 8080 -r asc6 scenario1
This show a workload with 10 users (-u 10) run on a Web server listening on port 8080 on a system called asc6. The workload is read from scenario1. A desired throughput of 200 URLs/sec (-t 200) for each user has been specified.
example% hammer -u 10 -n 1000 -p 8080 -r asc6 scenario1
This shows a workload with 10 users (-u 10) run on a Web server listening on port 8080 on a system called asc6. The workload is read from scenario1. 1000 URL operations (-n 1000) will be perform from the scenario file.
example% hammer -u 10 -c -p 8080 -r asc6 scenario1
This shows a workload with 10 users (-u 10) run on a Web server listening on port 8080 on a system called asc6. The workload is read from scenario1. Each user performs the entire workload as specified (-c) in the scenario file.
Exit Status
The following are possible exit status results of the hammer command on UNIX:
0 All information was written successfully.
>0 An error occurred.
Files
The scenario file is specified as a command line option to the hammer command. The scenario file contains a list of URL operations. In order to use the hammer command, you must have a scenario file to specify the workload that is run on the Web site using the hammer command.
Example GET Operation
The following is an example of one type of URL operation that is submitted via WebHammer to the Web site. It is a list of GET commands plus URLs.
GET /test/00/00/16/11/home.html
GET /test/00/00/16/12/home.html
GET /test/00/00/16/13/home.html
GET /test/00/00/16/14/home.html
GET /test/00/00/16/15/home.html
GET /test/00/00/16/16/home.html
GET /test/00/00/16/17/home.html
GET /test/00/00/16/18/home.html
GET /test/00/00/16/19/home.html
GET /test/00/00/16/20/home.html
GET /test/00/00/16/21/home.html
GET /test/00/00/16/22/home.html
GET /test/00/00/16/23/home.html
GET /test/00/00/16/24/home.html
GET /test/00/00/16/25/home.html
Example POST Operation
The following is an example of a POST operation. A POST operation is a URL operation that is sent to the Web server after you fill in a web form and click Submit or Send.
POST /AeosDemo/UserInput/portal_i_profile_username HTTP/1.0.Referer:
http://ias2:8080/AeosDemo/UserGet/profile/portal_i_profile_
username.htm?refnumber=1001235.Connection: Keep-Alive.User-Agent: Mozilla/4.72
[en] (X11; U; Linux 2.2.14-11.lfssmp i686).Host: ias2:8080.Accept: image/gif,
image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*.Accept-Encoding:
gzip.Accept-Language: en.Accept-Charset:iso-8859-1,*,utf-8.Authorization: Basic
UFUwMDAwMDAwNTpQVTAwMDAwMDA1.Content-type:
application/x-www-form-urlencoded.Content-length: 721.Content-type:
application/x-www-form-urlencoded.Content-length: 721.._
DESCRIBE=profile%2Fportal_i_profile_entry_Describe.dsc&_FORM_ACTION=portal_i_
profile_Submit&_PASS_URL=Standard_Pass.html&_FAIL_URL=Standard_Fail.html&_FAIL_
URL100=profile%2Fportal_errors_frameSet.htm&piprofid_ref=1001235&task_
ref=&pPostStr=%230%23&piprofid_ref=1001235&ppname_fname=joe15&ppname_
mname=j&ppname_
sname=bloggs15&pemail=jbloggs15%40oracle.com&pUserName=jbloggs15&paddress_
add1=&paddress_add2=&paddress_add3=&paddress_citytown=&paddress_
county=&paddress_cntry=country&ppname_fsalut=&paddress_postcode=d+5&pphonework_
std=&pphonework_number=&pphonehome_std=&pphonehome_number=&pphonemobile_
std=&pphonemobile_number=&pfaxhome_std=&pfaxhome_number=&pfaxwork_std=&pfaxwork_
number=&_submitForm.x=34&_submitForm.y=5
Log File
The overall duration for the workload is timed and the duration for each individual URL operation and corresponding number of bytes received for each URL operation is recorded. This information can be output to a log file (by specifying the option -o log_file) and placed in an exportable format.
The following table contains information about the output of the log file:
Table 3-1 Default Results
The following is an example of a log file, showing URL operations without displaying user information and header information:
0:2:300:1:0
1:1:300:1:0
2:1:300:1:0
3:1:300:1:0
4:1:300:1:0
5:1:300:1:0
6:1:300:1:0
7:1:300:1:0
8:1:300:1:0
9:1:300:1:0
10:1:300:1:0
11:1:300:1:0
12:1:300:1:0
13:1:300:1:0
14:1:300:1:0
15:1:300:1:0
16:1:300:1:0
17:1:300:1:0
18:1:300:1:0
19:1:300:1:0
20:1:300:1:0
21:1:300:1:0
22:1:300:1:0
The following table contains information about the output of the log file with heading summary information:
Table 3-2 Heading Summary Result
The following example displays log output for users and URLs with header
information for two virtual users:
[Transaction no] Transaction Time (msec): Bytes Rx
0:4:3000
[URL no] URL Time (msec): Bytes Rx: [URL]
0:2:300:1:0: GET /test/00/00/16/11/home.html
1:1:300:1:0: GET /test/00/00/16/12/home.html
2:1:300:1:0: GET /test/00/00/16/13/home.html
3:1:300:1:0: GET /test/00/00/16/14/home.html
4:1:300:1:0: GET /test/00/00/16/15/home.html
5:1:300:1:0: GET /test/00/00/16/16/home.html
6:1:300:1:0: GET /test/00/00/16/17/home.html
7:1:300:1:0: GET /test/00/00/16/18/home.html
8:1:300:1:0: GET /test/00/00/16/19/home.html
9:1:300:1:0: GET /test/00/00/16/21/home.html
[Transaction no] Transaction Time (msec): Bytes Rx
1:4:3000
[URL no] URL Time (msec): Bytes Rx: [URL]
0:2:300:1:0: GET /test/00/00/16/11/home.html
1:1:300:1:0: GET /test/00/00/16/12/home.html
2:1:300:1:0: GET /test/00/00/16/13/home.html
3:1:300:1:0: GET /test/00/00/16/14/home.html
4:1:300:1:0: GET /test/00/00/16/15/home.html
5:1:300:1:0: GET /test/00/00/16/16/home.html
6:1:300:1:0: GET /test/00/00/16/17/home.html
7:1:300:1:0: GET /test/00/00/16/18/home.html
8:1:300:1:0: GET /test/00/00/16/19/home.html
9:1:300:1:0: GET /test/00/00/16/21/home.html