|
|
|
|
|
- 1. 개요
ab는 ApacheBanch의 약자로, 웹서버의 성능을 체크할 수 있다.
2. ab 명령 옵션
ab 명령에 사용할 수 있는 옵션은 다음과 같다.
[root@qmail bin]# ./ab
./ab: wrong number of arguments
Usage: ./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)
3. ab로 아파치 성능 체크 예제
(1) 기본 옵션 (default)으로 체크
[root@qmail bin]# ./ab http://zeroboard.com/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking zeroboard.com (be patient).....done
Server Software: Apache/2.2.11
Server Hostname: zeroboard.com
Server Port: 80
Document Path: /
Document Length: 330 bytes
Concurrency Level: 1
Time taken for tests: 0.002 seconds
Complete requests: 1
Failed requests: 0
Broken pipe errors: 0
Non-2xx responses: 1
Total transferred: 585 bytes
HTML transferred: 330 bytes
Requests per second: 500.00 [#/sec] (mean)
Time per request: 2.00 [ms] (mean)
Time per request: 2.00 [ms] (mean, across all concurrent requests)
Transfer rate: 292.50 [Kbytes/sec] received
(2) -n (request 요청 수) 옵션을 설정하여 체크
* request 요청 수를 10으로 하여 체크하는 방법은 다음 명령을 수행하면 된다.
[root@qmail bin]# ./ab -n 10 http://zeroboard.com/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking zeroboard.com (be patient).....done
Server Software: Apache/2.2.11
Server Hostname: zeroboard.com
Server Port: 80
Document Path: /
Document Length: 330 bytes
Concurrency Level: 1
Time taken for tests: 0.023 seconds
Complete requests: 10
Failed requests: 0
Broken pipe errors: 0
Non-2xx responses: 10
Total transferred: 5850 bytes
HTML transferred: 3300 bytes
Requests per second: 434.78 [#/sec] (mean)
Time per request: 2.30 [ms] (mean)
Time per request: 2.30 [ms] (mean, across all concurrent requests)
Transfer rate: 254.35 [Kbytes/sec] received
Connnection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 1 2 0.0 2 2
Waiting: 1 1 0.0 1 1
Total: 2 2 0.0 2 2
ERROR: The median and mean for the initial connection time are more than twice the standard
deviation apart. These results are NOT reliable.
ERROR: The median and mean for the processing time are more than twice the standard
deviation apart. These results are NOT reliable.
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 2
98% 2
99% 2
100% 2 (last request)
(3) -c (다중 세션 요청 수) 옵션으로 체크
[root@qmail bin]# ./ab -c 10 http://zeroboard.com/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking zeroboard.com (be patient).....done
Server Software: Apache/2.2.11
Server Hostname: zeroboard.com
Server Port: 80
ocument Path: /
Document Length: 330 bytes
Concurrency Level: 10
Time taken for tests: 0.002 seconds
Complete requests: 1
Failed requests: 0
Broken pipe errors: 0
Non-2xx responses: 1
Total transferred: 585 bytes
HTML transferred: 330 bytes
Requests per second: 500.00 [#/sec] (mean)
Time per request: 20.00 [ms] (mean)
Time per request: 2.00 [ms] (mean, across all concurrent requests)
Transfer rate: 292.50 [Kbytes/sec] received
(4) -k (keepalive를 활성화) 옵션으로 체크
[root@qmail bin]# ./ab -k http://zeroboard.com/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking zeroboard.com (be patient).....done
Server Software: Apache/2.2.11
Server Hostname: zeroboard.com
Server Port: 80
Document Path: /
Document Length: 330 bytes
Concurrency Level: 1
Time taken for tests: 0.002 seconds
Complete requests: 1
Failed requests: 0
Broken pipe errors: 0
Non-2xx responses: 1
Keep-Alive requests: 0
Total transferred: 585 bytes
HTML transferred: 330 bytes
Requests per second: 500.00 [#/sec] (mean)
Time per request: 2.00 [ms] (mean)
Time per request: 2.00 [ms] (mean, across all concurrent requests)
Transfer rate: 292.50 [Kbytes/sec] received
(5) -w (테스트 결과를 html으로 저장하기)
[root@ns1 22:50:09 ~]$ ab -k -w -c 10 -n 1 http://zeroboard.com/ > mysite.bmt.html
이 명령을 수행하면 zeroboard.com 에 대한 테스트 결과가 mysite.bmt.html 이라는 파일로 저장이 된다.
|
|
|
|
|