1. AB(Apache HTTP server benchmarking tool) 소개

AB는 커맨드 라인을 활용한 매우 가볍고 유용한 웹서버 벤치마킹 도구 이다. 간단한 REST API나 정적 컨텐츠에 대한 성능 테스트 시에 빠르고 간편하게 벤치마킹 정보를 얻어올 수 있다.

2. AB 사용 용도

웹서버 쪽 성능 측정을 위해 만들어진 도구로, 복잡한 인증절차(세션을 사용한)를 포함한 페이지보다는 간단한 API(헤더 정보는 활용할 수 있으니)나 정적 컨텐츠로 구성 된 서비스 성능 측정에 적합해 보인다.

이벤트 진행 전 접속 한계치를 테스트하거나 튜닝 전 response time을 측정해야하는 경우 유용할 것 같다.

3. 설치방법

ApacheBench는 Apache HTTP 서버 배포에 포함되어 있으므로 시스템에 이미 설치되어 있을 수 있습니다. 설치되었는지 확인하려면 터미널에서 ab -V 명령을 실행하면 됩니다. 설치되지 않은 경우 시스템의 패키지 관리자를 사용하거나 Apache HTTP 서버를 다운로드하여 설치하면 된다.

4. 사용시 유의사항

- HTML이나 CSS, image등은 해석하지 않는다. 단순히 response 시간만 나타내준다.

- HTTP 1.0 클라이언트를 사용한다.

- 동적 페이지는 Content-Length 헤더 내용을 미리 작성할 수 없기 때문에 -k KeepAlive 옵션이 동작하지 않는다.

- HTTP 1.0 클라이언트이기 때문에 Transfer-Encoding: chunked 옵션은 사용할 수 없다.

- request간에 delay를 주는 옵션은 없으므로 DDOS attack으로 간주 될 수 있다.

5. 기본 사용법

$ ab
Usage: ab [options] [http[s]://]hostname[:port]/path

자주사용하는 옵션
-n - 만들 요청 수
-c - 동시 연결 수
-t - 테스트를 실행할 최대 시간
-k - HTTP KeepAlive 활성화
-H - 각 요청에 사용자 지정 HTTP 헤더 추가
-p - POST 요청의 본문을 포함하는 파일 지정
-T - POST 요청의 콘텐츠 유형 지정

6. AB 사용예시

http://www.google.com/index.html 파일에 대해서 10개의 동시요청으로 총 100개의 요청을 벤치마킹한 결과

$ ab -n 100 -c 10 -g result.plot http://www.google.com/index.html
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.google.com (be patient).....done


Server Software:
Server Hostname:        www.google.com
Server Port:            80

Document Path:          /index.html
Document Length:        271 bytes

Concurrency Level:      10
Time taken for tests:   9.019 seconds
Complete requests:      100
Failed requests:        2
   (Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
Non-2xx responses:      100
Total transferred:      49692 bytes
HTML transferred:       27096 bytes
Requests per second:    11.09 [#/sec] (mean)
Time per request:       901.890 [ms] (mean)
Time per request:       90.189 [ms] (mean, across all concurrent requests)
Transfer rate:          5.38 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       75   89  11.7     86     136
Processing:    80  763 143.0    799     900
Waiting:       75  441 231.8    445     875
Total:        180  852 143.0    886    1000

Percentage of the requests served within a certain time (ms)
  50%    886
  66%    900
  75%    909
  80%    919
  90%    953
  95%    981
  98%    995
  99%   1000
 100%   1000 (longest request)

태그: ,

카테고리:

업데이트:

댓글남기기