리눅스 명령어 - ab

Posted by 잿빛푸우 greypoooh@daum.net
2007.04.01 22:58 리눅스의 모든것

ab : Apache HTTP Server Benchmarking tools 의 약자로 아파치서버의 응답속도를 측정하는 툴이다.

[사용 옵션들]
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 containing 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: gzip'
                    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
    -s              Use httpS instead of HTTP (SSL)
    -h              Display usage information (this message)


먼저 ab의 버전을 확인해 보겠습니다.

windpyj@ubuntu:~$ ab -V
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> 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/
windpyj@ubuntu:~$


ex1) 네이버를 먼저 측정해 보았습니다.
-n 1 의 옵션은 지정된 URL을 한번 요청하여 결과를 보여 달라는 옵션입니다.

windpyj@ubuntu:~$ ab -n 1 http://www.naver.com/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> 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.naver.com (be patient).....done

Server Software:        Apache
Server Hostname:        www.naver.com
Server Port:            80
Document Path:          /
Document Length:        74123 bytes
Concurrency Level:      1
Time taken for tests:   0.345218 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Total transferred:      74420 bytes
HTML transferred:       74123 bytes
Requests per second:    2.90 [#/sec] (mean)
Time per request:       345.218 [ms] (mean)
Time per request:       345.218 [ms] (mean, across all concurrent requests)
Transfer rate:          208.56 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       46   46   0.0     46      46
Processing:   298  298   0.0    298     298
Waiting:       42   42   0.0     42      42
Total:        344  344   0.0    344     344
windpyj@ubuntu:~$


ex2) -c 30 옵션으로 측정해 보았습니다. -c 옵션은 다중세션을 측정하는 옵션입니다.
측정결과를 보시면 Concurreny Level 이 30으로 나옵니다.

windpyj@ubuntu:~$ ab -c 30 http://www.naver.com/
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> 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.naver.com (be patient).....done

Server Software:        Apache
Server Hostname:        www.naver.com
Server Port:            80
Document Path:          /
Document Length:        74093 bytes
Concurrency Level:      30
Time taken for tests:   0.435572 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Total transferred:      502224 bytes
HTML transferred:       493314 bytes
Requests per second:    2.30 [#/sec] (mean)
Time per request:       13067.160 [ms] (mean)
Time per request:       435.572 [ms] (mean, across all concurrent requests)
Transfer rate:          1124.96 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       46   46   0.0     46      46
Processing:   388  388   0.0    388     388
Waiting:       48   48   0.0     48      48
Total:        434  434   0.0    434     434
windpyj@ubuntu:~$

출처 : ServerMaster
신고
Tags
이 댓글을 비밀 댓글로