서버 & 시스템/Linux
apache 벤치마킹 스트레스툴 ab
잇츠유-
2021. 12. 28. 16:35
반응형
1. ab(Apache HTTP server Benchmarking tool 의 약어)
Apache 하이퍼텍스트 전송 프로토콜 (HTTP) 서버의 성능을 검사하는 벤치마킹 도구.
Apache가 초당 몇개의 요청을 서비스할 수 있는지 확인이 가능.
HTML이나 CSS, image, Java Script 등은 해석하지 않고 단순 response 시간만 나타남.
HTTP 1.0 클라이언트를 사용. Transfer-Encoding: chunked 옵션 사용 불가
request 간에 delay 를 주는 옵션이 없어 DDoS 로 간주 될 수 있으니 주의.
localhost 점검 중 아래와 같이 에러가 발생한다면
Issue: Invalid argument (22) when running apache bench (ab)
'http://localhost/' 가 아닌 'http://127.0.0.1/'로 테스트할 것.
2. ab설치
# apt-get install apache2-utils \\ Ubuntu # yum -y install httpd-tools \\ CentOS |
3. ab 이용 옵션
-n requests Number of requests to perform \\ 벤치마킹을 위한 요청수 -c concurrency Number of multiple requests to make \\ 동시에 수행할 요청 수. 사용자 수와 비슷 (기본값 : 1) -t timelimit Seconds to max. wait for responses \\ 제한시간 (ms단위) -p postfile File containg data to POST \\ POST 할 파일 지정 -T content-type Content-type header for POSTing -v verbosity How much troubleshooting info to print \\ 로그레벨 (1~4, 숫자가 클수록 자세한 로그 출력) -w Print out results in HTML tables \\ HTML 형태로 출력 (유용함) -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) |
4. ab 사용법
# ab [옵션] http(s)://[도메인][:포트][/경로] # ab -n [요청 수] -c [동시 호출 수] -t [시간 (초)] [도메인] # ab -n 100 -c 5 -t 60 https://www.naver.com/ → 100명의 동시 사용자가 각 5회씩 60초동안 요청, -c 옵션 값은 -n 의 옵션 값보다 클 수 없음 |
5. gnuplot 데이터를 통한 그래프 그리기
- gnuplot : 2차원이나 3차원 함수나 자료를 그래프로 그려 주는 명령행 응용 소프트웨어
해보진 않음.
https://blog.hkwon.me/ab-apache-http-server-benchmarking-tool/
반응형