2012-09-14

FreeBSD] ab (아파치 응답속도를 측정하는 툴)


ab
ab는 “Apache HTTP server Benchmarking tool”의 약어로서  아파치서버의 응답속도를 측정하는 밴치마킹툴입니다.
ab라는 툴을 이용하여 아파치의 응답속도를 테스트하고 그 결과를 다양한 방면으로 확인할 수 있습니다.  

사용형식
ab [ -k ] [ -i ] [ -n 요청수 ] [ -t 시간제한 ] [ -c 동시접속 ] [ -p POST file ] [ -A 인증 유저이름:패스워드 ] [ -P 프락시인증 유저이름:패스워드 ] [ -H Custom header ] [ -C Cookie name=value ] [ -T content-type ] [ -v verbosity ] ] [ -w HTML 출력 ] ] [ -x 속성 ] ] [ -y  속성 ] ] [ -z  속성 ] [http://]서버이름[:port]/path 

ab [ -V ] [ -h ]

사용예 #1
V를 사용하시면 설치되어 있는 ab의 버전을 확인하실 수있습니다. 아래 결과는 현재 필자가 사용하고 있는 ab의 버전이 2.0.40이라는 것을 표시하고 있습니다. 
[root@host3 bin]# ab -VThis is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
[root@host3 bin]#
사 용예 #2
수퍼유저코리아(www.superuser.co.kr)의 응답속도를 측정한 것입니다. 참고로 사이트URL의 마지막에는 반드시 "/"가 들어가야함에 주의하시기 바랍니다.  여기서 사용한 옵션 -n은 측정을 위한 웹페이지 요청수를 의미합니다. 즉 "-n 1"이라고 한 것은 지정한 URL을 한번의 요청만으로 결과를 표시한다는 의미입니다.
[root@host3 bin]# ab -n 1 http://www.superuser.co.kr/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.superuser.co.kr (be patient).....done

Server Software:        Apache/2.0
Server Hostname:        www.superuser.co.kr
Server Port:            80
Document Path:          /
Document Length:        458 bytes
Concurrency Level:      1
Time taken for tests:   1.499567 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Total transferred:      700 bytes
HTML transferred:       458 bytes
Requests per second:    0.67 [#/sec] (mean)
Time per request:       1499.567 [ms] (mean)
Time per request:       1499.567 [ms] (mean, across all concurrent requests)
Transfer rate:          0.00 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       17   17   0.0     17      17
Processing:  1482 1482   0.0   1482    1482
Waiting:     1481 1481   0.0   1481    1481
Total:       1499 1499   0.0   1499    1499
[root@host3 bin]#
사 용예 #3
다음과 같이 -c옵션을 사용하면 한번에 수행할 다중 요구수를 지정할 수 있습니다.  지정하지 않는다면 기본값은 1이 됩니다.  테스트시에 c 30이라고 주었으며, 결과를 보시면 concurrency Level30이라는 것을 보실 수 있을 것입니다. 즉, 동시에 다중세션을 테스트한 것이며 그 결과를 확인 할 수 있습니다. 결과값의 분석은 앞에 설명된 내용과 비교하면서 보시기 바랍니다.
[root@host3 bin]# ab -c 30 http://www.yahoo.com/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.116 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.yahoo.com (be patient).....done

Server Software:       
Server Hostname:        www.yahoo.com
Server Port:            80
Document Path:          /
Document Length:        32247 bytes
Concurrency Level:      30
Time taken for tests:   1.75287 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Total transferred:      32600 bytes
HTML transferred:       32247 bytes
Requests per second:    0.93 [#/sec] (mean)
Time per request:       32258.610 [ms] (mean)
Time per request:       1075.287 [ms] (mean, across all concurrent requests)
Transfer rate:          28.83 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      208  208   0.0    208     208
Processing:   866  866   0.0    866     866
Waiting:      219  219   0.0    219     219
Total:       1074 1074   0.0   1074    1074
root@host3 bin]#

저작권:수퍼유저코리아(www.superuser.co.kr), 무단 재배포및 복사를 금합니다.

댓글 없음:

댓글 쓰기