Simple use of Apachebench 2013-03-08 15:48:47
Category: LINUX
Apachebench Apache A gadget that comes with , dedicated to HTTP Server benchmark testing You can simulate multiple concurrent requests at the same time.
need to do stress testing on the web, so simply study it and make a note.
The environment used is centos5.5, using the Yum installation Apache,ab tool in the/usr/bin directory:
- [[email protected] ~]# cat/etc/redhat-release
- centos release 5.5 (Final)
-
- /usr/bin/ab
The basic form of AB:
- name
- ab-apache HTTP Server Benchmarking tool
-
synopsis
- ab [-A Auth-username: Password] [-B windowsize] [-c concurrency] [-c Cookie-name=value] [-d] [-e Csv-file] [-F Protocol] [-G GNUPL Ot-file] [-h] [-H custom-header] [-i]
- [-K "[-N requests] [-p Ost-file] [-P proxy-auth-username:password] [-Q] [-r] [-S] [-S] [-t timelimit] [-t content-type] [-u put-f Ile] [-v verbosity] [-v] [-W] [
- -x <table>-attributes] [-x P roxy[:p ort] [-y <tr>-attributes] [-Z <td>-attributes] [-Z ciphersuite] [http[s]://]hostname[:p Ort]/pat H
a simple test for Baidu and results:
- [Email protected] ~]# ab-n 100-c http://www.baidu.com/ ###-n: Number of requests issued-C: concurrency per session
- This is apachebench, Version 2.0.40-dev < $Revision: 1.146 $> apache-2.0
- Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
- Copyright 2006 the Apache software Foundation, http://www.apache.org/
- Benchmarking www.baidu.com (Be patient) ... done
- Server software:bws/1.0 # # # servers Information
- Server Hostname:www.baidu.com # # #域名
- Server port:80 # # #连-Connected ports
- Document Path:/ # #请求的URI
- Document length:10530 bytes # # #第一次返回文档的大小. If the size of the document changes during testing, the response is considered an error.
- Concurrency level:10 # # #并发数
- Time taken for tests:29.32944 seconds # # #开start to end
- Complete requests:100 # # #成功的请求数
- Failed requests:42 # # #失败的请求数
- (connect:0, length:42, exceptions:0) # # #详细的多少个连接失败, length exception, read failed
- Write errors:0 # # #在发送的时候失败的次数
- Total transferred:1131908 bytes # # #从服务器接收的字节数. This is the explicit network send byte.
- HTML transferred:1084140 bytes # # #html内容传输量
- Requests per second:3.44 [#/sec] (mean) # #每秒请求数
- Time per request:2903.294 [MS] (mean) # # #每个并发的时间
- Time per request:290.329 [MS] (mean, across all concurrent requests) # # #个人Understand how long each request is in each concurrency
- Transfer rate:38.06 [Kbytes/sec] Received # # # of network traffic per second
- Connection Times (MS)
- Min MEAN[+/-SD] Median max
- Connect:37 1003 809.6 898 4056 ## #The time it takes for the socket to make a request to establish a connection.
-
-
- total:336 2717 1248.4 2739 6655 # # #conn +processing
### 50% user response time is less than 3064 milliseconds, %< Span style= "color:red;" > milliseconds, the maximum response time is less than 3184 ms
- percentage of the requests served Within a certain Time (ms)
- 50% 2739
- 66% 3017
-
- 80% 3187
- 90 % 3998
- 95% 5607
- 98% 6095
- 99% 6655
- 100% 6655 (Longest request)
More parameters:
-A Auth-username:password some requests require a username and password for authentication: (For example: 401 authentication requirements).-B windowsize TCP sends and receives a buffer size in bytes-c concurrency concurrency, the number of requests sent at the same time, the default is 1. -C Cookie-name=value plus cookies: in the form of "Name=value", you can repeat the-C xx1=yy1-c xx2=yy2. -D does not show "percentage served within XX [MS] table".-e Csv-file write a comma-delimited CSV file containing the time (in milliseconds) that each percentage (from 1% to 100%) server executes, this file is generally is more useful than ' gunplot '. -F protocol Specifies the SSL/TLS protocol (SSL2, SSL3, TLS1, or All).-G Gnuplot-file Write all useful information to the TSV (Tab separate values) file, which can be easily imported into Excel Wait inside, label on the first line of the file. -H Display Help information-H custom-header Add additional header information. Split with a colon, for example ("Accept-encoding:zip/zop;8bit")-I sends a GET request-K to open the KeepAlive feature of HTTP. Executes multiple requests in an HTTP session. Default does not open. -N Requests the number of request checksums to execute. The default request once, the result of the request does not represent the verification result, is inaccurate. -P Post-file contains the POST data file-P Proxy-auth-username:password supports basic auth proxy route validation. At (required for HTTP code:407)-Q when the program has 150 requests, the output is displayed for every 10% or 100. -Q is used to cancel this information. -R does not exit when the socket is wrong. -S if used in the SSL protocol, the function is still in the experimental phase, you do not need to use it. -S does not display termination and standard values, nor does it display warning messages. The maximum time that the-T TimeLimit Checksum takes, internally set-n 50,000 times. Use this option to test within a specific time period. The-T Content-type is not turned on by default forPost/put data, such as eg. Application/x-www-form-urlencoded. Default:text/plain.-u put-file PUT file, remember to add-t-v verbosity set output level, 4 output header information, 3 output response code (404,200) 2 output warning and information-v display version, and then exit 。 -W output results to table in HTML, default two columns, white background. -X <table>-attributes String to use as attributes for <table>. Attributes is inserted <table here >.-x proxy[:p ORT] use a proxy. -Y <tr>-attributes setting properties to <tr>.-z <td>-attributes setting properties to <td>.-z Ciphersuite specifying SSL/TLS cipher sets (see OpenSSL ciphers).
Simple use of apachebench