반응형
AB 테스트란?
Command Line 활용한 웹서버 벤치마킹 도구
Rest API 에 간단한 부하테스트를 진행 할 수 있는 방법
AB 테스트의 참고사항
1 ) HTML이나 CSS, image등은 해석하지 않는다. response 시간만 표기함.
2 ) HTTP 1.0 클라이언트를 사용함.
3 ) 동적 페이지는 Content-Length 헤더 내용을 미리 작성할 수 없기 때문에 -k KeepAlive 옵션이 동작하지 않음.
4 ) 2 <로 인하여 Transfer-Encoding: chunked 옵션은 사용할 수 없음.
5 ) request간에 delay를 주는 옵션은 없으므로 DDOS attack으로 인식 될 수 있음.
AB 테스트 하는 방법
$ ab
Usage: ab [options] [http[s]://]hostname[:port]/path
옵션
-n : 성능을 검사하기위해 보내는 요청 수
-c : 동시에 요청하는 요청 수
-g : 결과를 기록
-t : 테스트 진행 최대 시간 Limit 초, 기본적으로 시간제한 Limit 없음
-v : 출력 옵션
4 이상이면 헤더에 대한 정보를,
3 이상이면 (404, 202, 등) 응답코드를,
2 이상이면 경고(warning)와 정보(info)를 출력한다.
-A : 프록시를 통해 BASIC Authentication 정보를 제공, ':' 로 구분한 사용자명과 암호를 base64 인코딩하여 전송
-X : proxy[:port] 프록시 서버를 사용하여 요청
예시 및 결과
⇒ ab -n 100 -c 10 -g result.plot http://www.naver.com/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.naver.com (be patient).....done
Server Software: NWS
Server Hostname: www.naver.com
Server Port: 80
Document Path: /
Document Length: 138 bytes
Concurrency Level: 10
Time taken for tests: 0.186 seconds
Complete requests: 100
Failed requests: 0
Non-2xx responses: 100
Total transferred: 33400 bytes
HTML transferred: 13800 bytes
Requests per second: 538.66 [#/sec] (mean)
Time per request: 18.564 [ms] (mean)
Time per request: 1.856 [ms] (mean, across all concurrent requests)
Transfer rate: 175.70 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 5 7 0.9 7 10
Processing: 5 8 3.7 8 28
Waiting: 5 8 3.7 8 28
Total: 12 16 3.9 15 36
Percentage of the requests served within a certain time (ms)
50% 15
66% 16
75% 16
80% 16
90% 17
95% 19
98% 36
99% 36
100% 36 (longest request)
결과 보는 법
- 실 테스트 시간
Time taken for tests: 0.186 seconds
- 동시 요청 건당 평균 시간
Time per request: 18.564 [ms] (mean)
- 요청 건당 평균 시간 :
Time per request: 1.856 [ms] (mean, across all concurrent requests)
반응형
'개발' 카테고리의 다른 글
[Docker] docker-compose로 서버 구축 nginx + python ( flask + uwsgi ) (0) | 2020.05.21 |
---|---|
virtualbox install error (0) | 2020.05.19 |
openssl - 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)' WARNING: Retrying (Retry... 문제 발생 (0) | 2020.03.18 |
절차 지향 (FP) / 객체 지향 프로그래밍 (OOP) (0) | 2020.03.03 |
linux / mac 에서 curl 명령어로 request 테스트 하기 (0) | 2020.03.03 |