$ ab
Usage: ab [options] [http[s]://]hostname[:port]/path
AB 명령어 자주 사용하는 옵션
옵션
설명
-n
- 성능을 검사하기위해 보내는 요청수. -요청을 한번만 보내기 때문에 일반적인 성능 검사 결과를 얻을 수 없음
-c
-동시에 요청하는 요청수 -기본적으로 한번에 한 요청만을 보냄
-C
-Cookie 헤더 사용
-H
-요청에 헤더 추가
-i
-GET 메소드 대신 HEAD 메소드 요청
-k
-KeepAlive 사용 -동적 페이지는 Centent-Length 헤더 내용을 미리 작성할 수 없기 때문에 -k KeepAlive 옵션이 동작하지 않음
-p
-POST 메소드 요청
-g
-측정한 모든 값을 'gnuplot' 혹은 TSV(Tab separate values, 탭으로 구분한 값) 파일에 기록 -라벨은 output 파일의 첫번째 라인을 참고
-t
-성능을 검사하는 최대 초단위 시간. -내부적으로 -n 50000을 가정 -정해진 시간동안 서버 성능을 검사할때 사용 -기본적으로 시간 제한 없이 검사
-v
-출력 수준을 지정 -4 이상이면 헤더에 대한 정보를 출력 -3 이상이면 (404, 202, 등) 응답코드를 출력 -2 이상이면 경고(warning)와 정보(info)를 출력
-A
-프록시를 통해 BASIC Authentication 정보를 제공 -:로 구분한 사용자명과 암호를 base64 인코딩하여 전송
-X
-proxy[:port] 프록시 서버를 사용하여 요청
AB 명령어에서 헷갈리는 대표적인 옵션 -c 옵션에 대한 설명
-c 옵션이 기본적으로 다른 부하툴과는 다른게 동작 → 3개의 프로세스(쓰레드)가 10개씩 요청하는 것이 아니라 3개의 풀을 가지고 10번 요청을 진행 $ ab -n 10 -c 3 http://www.google.com
-c옵션에서 숫자는 pool 개념으로 보면 됨 [1, 2, 3]
-c 옵션에 3을 선언하였으면, 시작을 3개의 요청을 시작했고, 만약 2번이 먼저 종료됐으면 2번을 4번으로 대체 요청 [1, 4, 3]
1번이 종료되면 5번으로 대체 요청 [5, 4, 3]
3번이 종료되면 6번이 대체 요청 [5, 4, 6]
10개의 요청을 순차로 처리함
AB 명령어 전체 옵션
$ ab
ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make at a time
-t timelimit Seconds to max. to spend on benchmarking
This implies -n 50000
-s timeout Seconds to max. wait for each response
Default is 30 seconds
-b windowsize Size of TCP send/receive buffer, in bytes
-B address Address to bind to when making outgoing connections
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header to use for POST/PUT data, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-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.
-q Do not show progress when doing more than 150 requests
-l Accept variable document length (use this for dynamic pages)
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-m method Method name
-h Display usage information (this message)
-I Disable TLS Server Name Indication (SNI) extension
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol
(SSL2, TLS1, TLS1.1, TLS1.2 or ALL)
Time per request: 16.00 【ms】 (mean, across all concurrent requests)
-요구에 응답한 시간
Transfer rate: 4533.69 【Kbytes/sec】 received
-초당 전송 가능한 용량
Client 측 ab 부하테스트 호출 테스트
1. 요청 400, 동시접속자 1
$ ab -n 400 -c 1 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 1
Time taken for tests: 10.191 seconds ### 총 시간
Complete requests: 400
Failed requests: 0 ### 에러 수
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 39.25 [#/sec] (mean) ==> 초당 처리 Request 수
Time per request: 25.476 [ms] (mean) ==> Request 당 처리 시간
Time per request: 25.476 [ms] (mean, across all concurrent requests)
Transfer rate: 9.31 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 21 25 5.7 23 59
Waiting: 21 25 5.7 23 59
Total: 21 25 5.7 23 59
Percentage of the requests served within a certain time (ms)
50% 23
66% 25
75% 28
80% 28
90% 30
95% 37
98% 44
99% 53
100% 59 (longest request)
2. 요청 400, 동시접속자 2
$ ab -n 400 -c 2 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 2
Time taken for tests: 10.103 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 39.59 [#/sec] (mean)
Time per request: 50.514 [ms] (mean)
Time per request: 25.257 [ms] (mean, across all concurrent requests)
Transfer rate: 9.40 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 22 50 16.1 49 152
Waiting: 22 50 16.1 49 152
Total: 22 50 16.1 49 152
Percentage of the requests served within a certain time (ms)
50% 49
66% 53
75% 58
80% 63
90% 73
95% 77
98% 87
99% 94
100% 152 (longest request)
3. 요청 400, 동시접속자 10
$ ab -n 400 -c 10 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 10
Time taken for tests: 10.262 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 38.98 [#/sec] (mean)
Time per request: 256.540 [ms] (mean)
Time per request: 25.654 [ms] (mean, across all concurrent requests)
Transfer rate: 9.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 24 254 111.9 240 681
Waiting: 24 254 111.9 240 681
Total: 24 254 111.9 241 682
Percentage of the requests served within a certain time (ms)
50% 241
66% 289
75% 338
80% 364
90% 408
95% 443
98% 500
99% 560
100% 682 (longest request)
4. 요청 400, 동시접속자 20
$ ab -n 400 -c 20 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 20
Time taken for tests: 10.454 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 38.26 [#/sec] (mean)
Time per request: 522.718 [ms] (mean)
Time per request: 26.136 [ms] (mean, across all concurrent requests)
Transfer rate: 9.08 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 24 514 273.4 515 1592
Waiting: 24 514 273.5 515 1592
Total: 25 514 273.4 515 1592
Percentage of the requests served within a certain time (ms)
50% 515
66% 624
75% 676
80% 711
90% 822
95% 996
98% 1230
99% 1284
100% 1592 (longest request)
5. 요청 400, 동시접속자 50
$ ab -n 400 -c 50 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 50
Time taken for tests: 10.614 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 37.69 [#/sec] (mean)
Time per request: 1326.737 [ms] (mean)
Time per request: 26.535 [ms] (mean, across all concurrent requests)
Transfer rate: 8.94 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 2
Processing: 25 1264 411.7 1265 2826
Waiting: 23 1264 411.7 1265 2826
Total: 25 1264 411.5 1266 2827
Percentage of the requests served within a certain time (ms)
50% 1266
66% 1418
75% 1506
80% 1561
90% 1780
95% 1948
98% 2222
99% 2323
100% 2827 (longest request)
6. 요청 400, 동시접속자 100
$ ab -n 400 -c 100 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 100
Time taken for tests: 10.580 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 37.81 [#/sec] (mean)
Time per request: 2645.001 [ms] (mean)
Time per request: 26.450 [ms] (mean, across all concurrent requests)
Transfer rate: 8.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.4 0 5
Processing: 28 2377 679.8 2498 3706
Waiting: 23 2376 679.8 2498 3706
Total: 29 2378 678.8 2499 3706
Percentage of the requests served within a certain time (ms)
50% 2499
66% 2675
75% 2807
80% 2840
90% 2995
95% 3176
98% 3394
99% 3534
100% 3706 (longest request)
7. 요청 400, 동시접속자 200
$ ab -n 400 -c 200 http://[도메인]:80/while.jsp
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking [도메인] (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Finished 400 requests
Server Software:
Server Hostname: [도메인]
Server Port: 80
Document Path: /while.jsp
Document Length: 2 bytes
Concurrency Level: 200
Time taken for tests: 9.756 seconds
Complete requests: 400
Failed requests: 0
Write errors: 0
Total transferred: 97200 bytes
HTML transferred: 800 bytes
Requests per second: 41.00 [#/sec] (mean)
Time per request: 4877.980 [ms] (mean)
Time per request: 24.390 [ms] (mean, across all concurrent requests)
Transfer rate: 9.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 3 3.2 2 9
Processing: 32 3750 1525.0 4534 6111
Waiting: 22 3750 1524.9 4528 6111
Total: 32 3753 1522.0 4535 6111
Percentage of the requests served within a certain time (ms)
50% 4535
66% 4719
75% 4896
80% 4978
90% 5173
95% 5265
98% 5612
99% 5727
100% 6111 (longest request)
테스트 시나리오 결과 해석
1. 본 테스트의 시나리오는 전체 요청 수인 400 Request를 처리
2. 동시 요청이 1, 2, 10, 20, 50, 100, 200일 경우 성능의 변화를 모니터링하는 것
요청
동시 접속
총소요시간(Sec)
실패
초당처리속도
개별처리속도(Sec)
400
1
10.191
0
39.25
0.025476 / 1
400
2
10.103
0
39.59
0.050514 / 2
400
10
10.262
0
38.98
0.25654 / 10
400
20
10.454
0
38.26
0.522718 / 20
400
50
10.614
0
37.69
1.326737 / 50
400
100
10.58
0
37.81
2.645001 / 100
400
200
9.756
0
41
4.87798 / 200
3. 동시 접속자가 늘어나도 초당 처리 속도는 비슷하게 측정 → 400 / 200 (총 요청 수 / 동시 요청 수)일 경우 초당 처리 요청이 가능 많음
4. Single Instance의 처리 속도 아래 표의 결과는 LoadBalancer를 두고 처리할 성능 지표
요청
동시 접속
총소요시간(Sec)
실패
초당처리속도
개별처리속도(Sec)
400
200
9.163
0
43.65
2.811523
5. 한대의 서버에서 테스트가 힘들면, 서버의 대수를 늘리면 됨
6. 수동의 작업들을 완전히 자동화 해주는 오토스켈링(AutoScaling)과 ELB가 만나게 되면 엄청난 시너지 효과를 내타냄
개발자가 개발하면서 동시에 테스트해 정량적 데이터를 기준으로 성능 개선이 가능한 점이 편리함
siege는 유닉스 기반의 명령행 기반 툴으로, GNU GPL 오픈소스 라이선스를 따르기 때문에 사용, 수정, 배포가 모두 무료
siege는 단일 URL의 부하 테스트는 물론 많은 URL을 메모리로 불러들여 사용자가 설정한 시뮬레이션 유저만큼의 부하를 동시에 테스트할 수 있음
기록된 총 히트수와 전송된 바이트수, 반응시간, 병행성(Concurrency), 리턴 상태 등을 보여주며, HTTP 1.0/1.1 프로토콜, GET/POST 디렉티브, 쿠키, 트랜잭션 로깅, 기본적인 인증 등을 지원
1. Linux에서 siege HTTP 부하 테스트 유틸리티 설치
1.1. CentOS/RHEL에서 siege 설치
$ yum groupinstall 'Development Tools'
$ yum install -y epel-release
$ yum install -y siege
# 설치 후 siege 버전 확인
$ siege --version
SIEGE 4.1.1
Copyright (C) 2021 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
1.2. wget 명령어를 사용하여 최신 버전의 siege를 다운로드 후에 설치
# 최신 버전은 siege 다운로드 및 압축 해제
$ wget http://download.joedog.org/siege/siege-latest.tar.gz
$ tar -zxvf siege-latest.tar.gz
$ cd siege-*/
# 컴파일 및 설치
$ ./configure --prefix=/usr/local --with-ssl=/usr/bin/openssl
$ make
$ make install
# 설치된 siege 명령어 위치 확인
$ which siege
/usr/local/bin/siege
# 설치 후 siege 버전 확인
$ siege --version
SIEGE 4.1.5
Copyright (C) 2022 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
2. Linux에서 Siege HTTP로드 테스트 유틸리티 구성
설치를 완료하면 Siege 구성 파일 조정 가능
yum을 통해 siege 명령어를 다운받는 경우 생성 구성 파일 : /etc/siege/siegerc
소스에서 패키지를 빌드로 설치한 경우 생성 구성 파일 ; /usr/local/bin/siege.config
# ~/.siege/siege.conf에있는 siege.conf 파일이 생성
$ siege.config
siegerc 파일 또는 siege.conf 파일 확인 → siege이 1 분에 25 명의 동시 사용자를 모방
- 테스트를 실행할 시간 설정 - 테스트 실행 시간 단윈 : S, M, H - 예시 : -t 10S → 10초 동안 테스트 지정
-d
- 각 사용자 요청 사이의 시간 지연 지정
-b
- 요청 사이에 지연이 없도록 설정
-i
- user 시뮬레이션 - 임의의 URL을 적중하는 데 사용
-f
- 지정된 파일에서 URL을 테스트
-l
- 로그 파일 지정
-H
- 요청할 헤더를 추가함
-A
- 사용자 에이전드(User-Agent)를 지정
-T
- 요청의 Content-Type을 지정
--no-parser
- HTML 페이지 parser를 off
--no-follow
- HTTP 리디렉션을 따르지 않음
4. siege 출력 결과 설명
구분
설명
Transactions
- HTTP 요청횟수 -예상되는 히트 수보다 더 많이 출력 가능 -리다이렉션이나 인증문제로 2개의 히트를 하나로 계산하지 않음 → HTTP 사용을 따르는 브라우저 동작을 모방
Availability
-서버가 성공적으로 처리하는 소켓 연결의 확률 -성공 횟수/연결시도 횟수 * 100 ( 400, 500 에러 제외)
Elapsed time
-전체 siege 테스트 하는데 걸리는 시간
Data transferred
-siege가 시뮬레이션 된 브라우저에 전송하는 전체 데이터량 -전체 데이터는 컨텐츠 뿐만 아니라 헤더 정보까지 포함 -헤더 정보를 포함하기에 , siege가 표시하는 전체 데이터량은 서버가 전달하는 양보다 큼 -특정 설정 파일에 있는 임의의 URL을 사용하는 internet 모드로 설정된 상황에서는 전체 전송 데이터량은 동작할 때마다 각각 값이 달라짐
Response time
-siege가 시뮬레이션 된 브라우저의 각 요청에 대해 걸린 평균 응답시간
Transaction rate
-서버가 초당 처리할수 있는 트랜잭션 개수
Throughput
-서버에서 시뮬레이션 된 브라우저로 초당 전송되는 평균바이트단위의 데이터량
Concurrency
-동시 연결할수 있는 평균 개수이고, 증가할때마다 서버의 성능은 저하됨
Successful transactions
-트랜젝션 성공 횟수 -서버가 400 이하의 응답코드를 반환하는 횟수
Failed transactions
-트랜젝션 실패 횟수 -서버가 400 혹은 그이상의 응답코드를 반환하는 횟수 -타임아웃 횟수를 포함한 소켓 연결이 실패된 트랜잭션의 합계도 나타냄
Longest transaction
-모든 트랜잭션중 단일 트랜잭션 처리에 걸린 가장 긴시간
Shortest transaction
-모든 트랜잭션중 단일 트랜잭션 처리에 걸린 가장 짧은 시간
5. siege 테스트
5.1. 1명의 가상의 유저가 1초동안 무제한으로 계속해서 접속 부하 테스트 (지연 X)
$ siege -c1 -t1s http://[domain]/test/upload/1.jpg
** SIEGE 4.1.1
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
....생략....
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.00 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
Lifting the server siege...
Transactions: 95 hits
Availability: 100.00 %
Elapsed time: 0.57 secs
Data transferred: 13.85 MB
Response time: 0.01 secs
Transaction rate: 166.67 trans/sec
Throughput: 24.29 MB/sec
Concurrency: 0.98
Successful transactions: 95
Failed transactions: 0
Longest transaction: 0.04
Shortest transaction: 0.00
5.2. 1명의 가상의 유저가 1초동안 1초 간격으로 계속해서 접속 부하 테스트 (가상 유저의 요청 간격은 1초)
$ siege -c1 -t1s -d 1 http://[도메인]/test/upload/1.jpg
** SIEGE 4.1.1
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.08 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.00 secs: 152849 bytes ==> GET /test/upload/1.jpg
Lifting the server siege...
Transactions: 2 hits
Availability: 100.00 %
Elapsed time: 0.34 secs
Data transferred: 0.29 MB
Response time: 0.04 secs
Transaction rate: 5.88 trans/sec
Throughput: 0.86 MB/sec
Concurrency: 0.24
Successful transactions: 2
Failed transactions: 0
Longest transaction: 0.08
Shortest transaction: 0.00
5.3. 10명의 가상의 유저가 1초동안 1초 간격으로 계속해서 접속 부하 테스트 (가상 유저의 요청 간격은 1초)
$ siege -c10 -t1s -d 1 http://[도메인]/test/upload/1.jpg
** SIEGE 4.1.1
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.00 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.05 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.00 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.00 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
Lifting the server siege...
Transactions: 16 hits
Availability: 100.00 %
Elapsed time: 0.34 secs
Data transferred: 2.33 MB
Response time: 0.03 secs
Transaction rate: 47.06 trans/sec
Throughput: 6.86 MB/sec
Concurrency: 1.47
Successful transactions: 16
Failed transactions: 0
Longest transaction: 0.05
Shortest transaction: 0.04
5.4. 10명의 가상의 유저가 10회 반복으로 접속 부하 테스트
$ siege -c10 -r 10 http://[도메인]/test/upload/1.jpg
** SIEGE 4.1.1
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.04 secs: 152849 bytes ==> GET /test/upload/1.jpg
...생략...
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
HTTP/1.1 200 0.01 secs: 152849 bytes ==> GET /test/upload/1.jpg
Transactions: 100 hits
Availability: 100.00 %
Elapsed time: 0.17 secs
Data transferred: 14.58 MB
Response time: 0.02 secs
Transaction rate: 588.24 trans/sec
Throughput: 85.75 MB/sec
Concurrency: 9.41
Successful transactions: 100
Failed transactions: 0
Longest transaction: 0.06
Shortest transaction: 0.00
5.5. 1명의 가상의 유저가 특정 파일의 URL을 읽어서 접속 부하 테스트
# dims_list.txt 파일에는 서로 다른 URL 있음(위 URL 묶음을 넣을 수 있음)
$ siege -c1 -r 40 -f dims_list.txt
** SIEGE 4.1.1
** Preparing 1 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.06 secs: 140803 bytes ==> GET /test/upload/1.jpg/dims/resize/500X500
HTTP/1.1 200 0.05 secs: 183271 bytes ==> GET /test/upload/2.jpg/dims/resize/500X500
HTTP/1.1 200 0.35 secs: 350565 bytes ==> GET /test/upload/3.jpg/dims/resize/500X500
HTTP/1.1 200 0.04 secs: 101547 bytes ==> GET /test/upload/4.jpg/dims/resize/500X500
...생략...
HTTP/1.1 200 0.04 secs: 151130 bytes ==> GET /test/upload/36.jpg/dims/resize/500X500
HTTP/1.1 200 0.04 secs: 130278 bytes ==> GET /test/upload/37.jpg/dims/resize/500X500
HTTP/1.1 200 0.05 secs: 161169 bytes ==> GET /test/upload/38.jpg/dims/resize/500X500
HTTP/1.1 200 0.04 secs: 150939 bytes ==> GET /test/upload/39.jpg/dims/resize/500X500
HTTP/1.1 200 0.04 secs: 133090 bytes ==> GET /test/upload/40.jpg/dims/resize/500X500
Transactions: 40 hits
Availability: 100.00 %
Elapsed time: 2.40 secs
Data transferred: 6.87 MB
Response time: 0.06 secs
Transaction rate: 16.67 trans/sec
Throughput: 2.86 MB/sec
Concurrency: 1.00
Successful transactions: 40
Failed transactions: 0
Longest transaction: 0.36
Shortest transaction: 0.03
5.6. 40명의 가상의 유저가 특정 파일의 URL을 읽어서 접속 부하 테스트
# dims_list.txt 파일에는 서로 다른 URL 있음(위 URL 묶음을 넣을 수 있음)
$ siege -c40 -r 1 -f dims_list.txt
** SIEGE 4.1.1
** Preparing 40 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.08 secs: 173928 bytes ==> GET /test/upload/11.jpg/dims/resize/500X500
HTTP/1.1 200 0.08 secs: 130312 bytes ==> GET /test/upload/5.jpg/dims/resize/500X500
HTTP/1.1 200 0.08 secs: 241077 bytes ==> GET /test/upload/28.jpg/dims/resize/500X500
HTTP/1.1 200 0.09 secs: 116310 bytes ==> GET /test/upload/12.jpg/dims/resize/500X500
HTTP/1.1 200 0.09 secs: 181265 bytes ==> GET /test/upload/14.jpg/dims/resize/500X500
...생략...
HTTP/1.1 200 0.21 secs: 200534 bytes ==> GET /test/upload/26.jpg/dims/resize/500X500
HTTP/1.1 200 0.22 secs: 249170 bytes ==> GET /test/upload/9.jpg/dims/resize/500X500
HTTP/1.1 200 0.41 secs: 360241 bytes ==> GET /test/upload/13.jpg/dims/resize/500X500
HTTP/1.1 200 0.47 secs: 350565 bytes ==> GET /test/upload/3.jpg/dims/resize/500X500
Transactions: 40 hits
Availability: 100.00 %
Elapsed time: 0.47 secs
Data transferred: 6.87 MB
Response time: 0.15 secs
Transaction rate: 85.11 trans/sec
Throughput: 14.63 MB/sec
Concurrency: 12.51
Successful transactions: 40
Failed transactions: 0
Longest transaction: 0.47
Shortest transaction: 0.08
5.7. 200명의 가상의 유저가 특정 파일의 URL을 읽어서 접속 부하 테스트
# 200_dims_list.txt 파일에 resize 크기만 다르게 하여서 200개 생성
$ siege -c200 -r 1 -f 200_dims_list.txt
** SIEGE 4.1.1
** Preparing 200 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.11 secs: 22699 bytes ==> GET /test/upload/12.jpg/dims/resize/200X200
HTTP/1.1 200 0.12 secs: 218332 bytes ==> GET /test/upload/37.jpg/dims/resize/700X700
HTTP/1.1 200 0.13 secs: 25510 bytes ==> GET /test/upload/31.jpg/dims/resize/200X200
HTTP/1.1 200 0.16 secs: 130278 bytes ==> GET /test/upload/37.jpg/dims/resize/500X500
HTTP/1.1 200 0.16 secs: 27489 bytes ==> GET /test/upload/39.jpg/dims/resize/200X200
HTTP/1.1 200 0.22 secs: 131463 bytes ==> GET /test/upload/35.jpg/dims/resize/500X500
HTTP/1.1 200 0.26 secs: 31468 bytes ==> GET /test/upload/36.jpg/dims/resize/200X200
...생략...
HTTP/1.1 200 2.91 secs: 1531300 bytes ==> GET /test/upload/14.jpg/dims/resize/2100X2100
HTTP/1.1 200 2.93 secs: 1870440 bytes ==> GET /test/upload/2.jpg/dims/resize/2100X2100
HTTP/1.1 200 2.94 secs: 1286358 bytes ==> GET /test/upload/38.jpg/dims/resize/2100X2100
HTTP/1.1 200 3.11 secs: 350565 bytes ==> GET /test/upload/3.jpg/dims/resize/500X500
HTTP/1.1 200 3.26 secs: 621024 bytes ==> GET /test/upload/13.jpg/dims/resize/700X700
HTTP/1.1 200 3.31 secs: 68988 bytes ==> GET /test/upload/3.jpg/dims/resize/200X200
HTTP/1.1 200 3.60 secs: 360241 bytes ==> GET /test/upload/13.jpg/dims/resize/500X500
HTTP/1.1 200 3.64 secs: 609878 bytes ==> GET /test/upload/3.jpg/dims/resize/700X700
HTTP/1.1 200 4.56 secs: 1044667 bytes ==> GET /test/upload/3.jpg/dims/resize/1000X1000
HTTP/1.1 200 6.75 secs: 3148711 bytes ==> GET /test/upload/3.jpg/dims/resize/2100X2100
HTTP/1.1 200 7.96 secs: 3231253 bytes ==> GET /test/upload/13.jpg/dims/resize/2100X2100
Transactions: 200 hits
Availability: 100.00 %
Elapsed time: 7.98 secs
Data transferred: 100.42 MB
Response time: 1.60 secs
Transaction rate: 25.06 trans/sec
Throughput: 12.58 MB/sec
Concurrency: 40.20
Successful transactions: 200
Failed transactions: 0
Longest transaction: 7.96
Shortest transaction: 0.11
Usage: vegeta [global flags] <command> [command flags]
global flags:
-cpus int
Number of CPUs to use (defaults to the number of CPUs you have)
-profile string
Enable profiling of [cpu, heap]
-version
Print version and exit
attack command:
-body string
Requests body file
-cert string
TLS client PEM encoded certificate file
-chunked
Send body with chunked transfer encoding
-connections int
Max open idle connections per target host (default 10000)
-duration duration
Duration of the test [0 = forever]
-format string
Targets format [http, json] (default "http")
-h2c
Send HTTP/2 requests without TLS encryption
-header value
Request header
-http2
Send HTTP/2 requests when supported by the server (default true)
-insecure
Ignore invalid server TLS certificates
-keepalive
Use persistent connections (default true)
-key string
TLS client PEM encoded private key file
-laddr value
Local IP address (default 0.0.0.0)
-lazy
Read targets lazily
-max-body value
Maximum number of bytes to capture from response bodies. [-1 = no limit] (default -1)
-max-workers uint
Maximum number of workers (default 18446744073709551615)
-name string
Attack name
-output string
Output file (default "stdout")
-proxy-header value
Proxy CONNECT header
-rate value
Number of requests per time unit [0 = infinity] (default 50/1s)
-redirects int
Number of redirects to follow. -1 will not follow but marks as success (default 10)
-resolvers value
List of addresses (ip:port) to use for DNS resolution. Disables use of local system DNS. (comma separated list)
-root-certs value
TLS root certificate files (comma separated list)
-targets string
Targets file (default "stdin")
-timeout duration
Requests timeout (default 30s)
-unix-socket string
Connect over a unix socket. This overrides the host address in target URLs
-workers uint
Initial number of workers (default 10)
encode command:
-output string
Output file (default "stdout")
-to string
Output encoding [csv, gob, json] (default "json")
plot command:
-output string
Output file (default "stdout")
-threshold int
Threshold of data points above which series are downsampled. (default 4000)
-title string
Title and header of the resulting HTML page (default "Vegeta Plot")
report command:
-buckets string
Histogram buckets, e.g.: "[0,1ms,10ms]"
-every duration
Report interval
-output string
Output file (default "stdout")
-type string
Report type to generate [text, json, hist[buckets], hdrplot] (default "text")
examples:
echo "GET http://localhost/" | vegeta attack -duration=5s | tee results.bin | vegeta report
vegeta report -type=json results.bin > metrics.json
cat results.bin | vegeta plot > plot.html
cat results.bin | vegeta report -type="hist[0,100ms,200ms,300ms]"
vegeta 부하테스트의 기본 컨맨드 설명
1. attack
공격을 어떻게 할 것인지에 대한 명령
-duration 옵션
대상에 요청을 발행하는 시간을 지정 → 얼마동안 공격을 할 것인가 대한 값
내부 동시성 구조의 설정은 -duration 값을 변수로 가지고 있음
테스트의 실제 실행 시간은 응답 지연으로 인해 지정된 것보다 더 길 수 있음
무한 공격에 0 사용
5초 동안 공격 예시
-duration=5s
-rate 옵션
대상에 대해 발행할 시간 단위당 요청 비율을 지정
실제 요청 비율은 가비지 수집 등으로 인해 약간 다를 수 있지만 전반적으로 지정된 값에 매우 가깝게 유지됨
기본적으로 1초에 몇개를 보낼 것인지 결정 → 설정하지 않은 경우 50/1s
만약 0으로 하게 되면 무한으로 요청보내게 되는데 그럴 경우에는 추가적으로 max-workers의 수를 지정 필요
host 당 1초에 10번 요청
-rate=10
-max-workers 옵션
max-workers는 vegeta를 실행할 때 같이 설정할 수 있는 옵션
worker는 만들어져서 공격을 하게 되는데 최대 몇개의 worker을 사용할 것인가에 해당하는 값을 지정
-max-workers는 공격에 사용되는 최대 작업자 수 지정
공격에서 사용하는 동시성 수준을 제어하는 데 사용 가능
-max-workers=10
2. report
결과값에 대해서 어떤 형식으로 볼 것인지에 대해서 설정하는 command
기본 설정인 text 출력 (-type=text)
Requests → 테스트 중에 전송된 총 요청 수와 요청 비율을 출력
Duration → 테스트의 총 기간, 애플리케이션에 대한 부하를 시뮬레이션하는 공격 기간 및 대기 시간을 출력
Latencies → 공격에 포함된 모든 요청의 지연 시간과 인식된 최대 지연 시간의 평균 지연 시간(각각 50번째, 95번째, 99번째 백분위수)을 출력
Bytes In → 요청 본문과 함께 전송 또는 수신된 바이트 수
Bytes Out → 응답 본문과 함께 출력 또는 송신된 바이트 수
Success → 애플리케이션으로 전송된 성공적인 요청의 백분위수를 출력
Status Codes → 수신된 HTTP 응답 코드 및 해당 발생에 대한 카운터를 제공 (0 상태 코드는 요청 전송에 실패를 의미)
리눅스 디스크 속도 측정, 리눅스 cpu 속도 확인, 리눅스 메모리 속도 측정에 사용될 수 있는 명령어
sysbench 명령어는 인텐시브한 로드에서 데이터베이스를 운영해야하는 시스템에 필요한 운영체제를 평가하는 모듈화된 크로스 플랫폼 멀티 쓰레드 벤치마크 도구
데이터베이스를 설치하지 않고도 복잡한 세팅없이 시스템 성능을 분석 가능
VPS(virtual private server)를 사용하는 경우 업체에서 하드웨어 사양을 정확하게 명시하지는 않기 때문에 성능을 비교하는 데이터로도 활용 가능
sysbench 제공 기능
파일 입출력 성능
스케쥴러 성능
메모리 할당 및 전달 속도
POSIX 쓰레드 구현 성능
데이터베이스 서버 성능
sysbench 설치
$ yum install -y sysbench
sysbench 명령어 3가지 부분
명령어 구분
prepare → 테스트 데이터를 생성하는 과정
run → 실제 테스트를 실행 (oltp-read-write, oltp-read-only 등)
cleanup → 테스트 데이터를 삭제하는 과정
성능테스트 실행
"준비 -> 실행 -> 삭제" 순서로 진행
컴파일된 테스트 속성
fileio → 파일 I/O 테스트
cpu → CPU 성능 테스트
memory→ 메모리 기능 속도 테스트
threads→ 스레드 하위 시스템 성능 테스트
mutex → 뮤텍스 성능 테스트
sysbench 명령어 테스트
1. CPU 테스트 → total time이 낮을 수록 좋음
소수 생성을 100000개 하여 cpu 테스트(기본적)
$ sysbench --test=cpu --cpu-max-prime=100000 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 100000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 42.93
General statistics:
total time: 10.0109s
total number of events: 430
Latency (ms):
min: 22.98
avg: 23.28
max: 65.15
95th percentile: 23.10
sum: 10010.21
Threads fairness:
events (avg/stddev): 430.0000/0.00
execution time (avg/stddev): 10.0102/0.00
CPU 코어 수에 맞춰 cpu 테스트 → 하이퍼 스레드를 적용하고 있다면 코어 수에 x2를 하여 --cpu-max-prime 값을 적용
# CPU 코어 확인
$ lscpu | grep -i "^CPU(s)"
CPU(s): 40
# CPU 코어 40개 활용하여 테스트
$ sysbench --test=cpu --cpu-max-prime=100000 --num-threads=40 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 40
Initializing random number generator from current time
Prime numbers limit: 100000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 1256.42
General statistics:
total time: 10.0281s
total number of events: 12602
Latency (ms):
min: 27.73
avg: 31.75
max: 75.39
95th percentile: 31.37
sum: 400126.02
Threads fairness:
events (avg/stddev): 315.0500/2.31
execution time (avg/stddev): 10.0032/0.02
2. Memory 테스트 → Read + Write = total이 높을 수록 좋음
현재 설정된 메모리 기본값 검사 → 메모리 테스트의 기본값은 쓰기이므로 쓰기 테스트 값이 나옴
$ sysbench --test=memory run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 1KiB
total size: 102400MiB
operation: write
scope: global
Initializing worker threads...
Threads started!
Total operations: 46492508 (4646316.29 per second)
45402.84 MiB transferred (4537.42 MiB/sec)
General statistics:
total time: 10.0002s
total number of events: 46492508
Latency (ms):
min: 0.00
avg: 0.00
max: 0.02
95th percentile: 0.00
sum: 4387.09
Threads fairness:
events (avg/stddev): 46492508.0000/0.00
execution time (avg/stddev): 4.3871/0.00
메모리 write 테스트(설정 有)
memory block size는 1K
전역 메모리 사용
메모리 전체 사이즈는 128G
write 테스트
$ sysbench --test=memory --memory-block-size=1K --memory-scope=global --memory-total-size=128G --memory-oper=write run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 1KiB
total size: 131072MiB
operation: write
scope: global
Initializing worker threads...
Threads started!
Total operations: 46494366 (4646521.96 per second)
45404.65 MiB transferred (4537.62 MiB/sec)
General statistics:
total time: 10.0002s
total number of events: 46494366
Latency (ms):
min: 0.00
avg: 0.00
max: 0.10
95th percentile: 0.00
sum: 4385.85
Threads fairness:
events (avg/stddev): 46494366.0000/0.00
execution time (avg/stddev): 4.3859/0.00
메모리 write 테스트(설정 有)
memory block size는 1K
전역 메모리 사용
메모리 전체 사이즈는 128G
read 테스트
$ sysbench --test=memory --memory-block-size=1K --memory-scope=global --memory-total-size=128G --memory-oper=read run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Running memory speed test with the following options:
block size: 1KiB
total size: 131072MiB
operation: read
scope: global
Initializing worker threads...
Threads started!
Total operations: 58485027 (5844890.88 per second)
57114.28 MiB transferred (5707.90 MiB/sec)
General statistics:
total time: 10.0002s
total number of events: 58485027
Latency (ms):
min: 0.00
avg: 0.00
max: 0.09
95th percentile: 0.00
sum: 2841.56
Threads fairness:
events (avg/stddev): 58485027.0000/0.00
execution time (avg/stddev): 2.8416/0.00
3. Disk 테스트 → 결과 값이 높을 수록 좋음
리눅스는 기본적으로 Disk 캐시가 정용되어 있기 때문에 현재 장착된 RAM 크기보다 큰 값을 옵션으로 넣어야 함
리눅스 Disk 속도를 측정하기 위해서는 테스트 파일을 준비
테스트 파일을 Disk에 저장하고 테스트를 진행
테스트용 더미 파일을 준비 → 전체 용량이 350G 파일을 준비
지정한 파일 크기를 128개로 나눠 생성
마지막 라인에 초당 생성한 파일 용량이 표시
$ sysbench --test=fileio --file-total-size=350G prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
128 files, 2867200Kb each, 358400Mb total
Creating files for the test...
Extra file open flags: (none)
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
Creating file test_file.4
[...중략...]
Creating file test_file.124
Creating file test_file.125
Creating file test_file.126
Creating file test_file.127
375809638400 bytes written in 2320.59 seconds (154.44 MiB/sec).
# test_file.* 이름으로 파일이 생성 (2.8G 파일이 총 128개 생성)
$ ls -alh test_file.*
-rw------- 1 root root 2.8G Oct 13 11:07 test_file.0
-rw------- 1 root root 2.8G Oct 13 11:07 test_file.1
-rw------- 1 root root 2.8G Oct 13 11:09 test_file.10
-rw------- 1 root root 2.8G Oct 13 11:38 test_file.100
-rw------- 1 root root 2.8G Oct 13 11:38 test_file.101
[...생략...]
60초동안 순차 읽기 I/O (seqrd) → 테스트용 더미 파일에 문제가 있으면 다시 생성하여 테스트 필요
$ sysbench --test=fileio --file-test-mode=seqrd --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential read test
Initializing worker threads...
Threads started!
File operations:
reads/s: 8942.74
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 139.73
written, MiB/s: 0.00
General statistics:
total time: 60.0005s
total number of events: 536615
Latency (ms):
min: 0.00
avg: 0.11
max: 160.53
95th percentile: 0.57
sum: 59796.43
Threads fairness:
events (avg/stddev): 536615.0000/0.00
execution time (avg/stddev): 59.7964/0.00
60초동안 순차 쓰기 I/O (seqwr)
$ sysbench --test=fileio --file-test-mode=seqwr --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential write (creation) test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 13674.29
fsyncs/s: 17503.17
Throughput:
read, MiB/s: 0.00
written, MiB/s: 213.66
General statistics:
total time: 60.0047s
total number of events: 1870845
Latency (ms):
min: 0.00
avg: 0.03
max: 172.79
95th percentile: 0.03
sum: 59169.98
Threads fairness:
events (avg/stddev): 1870845.0000/0.00
execution time (avg/stddev): 59.1700/0.00
60초동안 순차 다시 쓰기 I/O (seqrewr)
$ sysbench --test=fileio --file-test-mode=seqrewr --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential rewrite test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 13543.70
fsyncs/s: 17337.94
Throughput:
read, MiB/s: 0.00
written, MiB/s: 211.62
General statistics:
total time: 60.0008s
total number of events: 1852962
Latency (ms):
min: 0.00
avg: 0.03
max: 38.39
95th percentile: 0.02
sum: 59021.35
Threads fairness:
events (avg/stddev): 1852962.0000/0.00
execution time (avg/stddev): 59.0214/0.00
60초동안 랜덤 읽기 I/O (rndrd) → 테스트용 더미 파일에 문제가 있으면 다시 생성하여 테스트 필요
$ sysbench --test=fileio --file-test-mode=rndrd --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random read test
Initializing worker threads...
Threads started!
File operations:
reads/s: 287.78
writes/s: 0.00
fsyncs/s: 0.00
Throughput:
read, MiB/s: 4.50
written, MiB/s: 0.00
General statistics:
total time: 60.0024s
total number of events: 17269
Latency (ms):
min: 0.01
avg: 3.47
max: 373.61
95th percentile: 7.84
sum: 59957.77
Threads fairness:
events (avg/stddev): 17269.0000/0.00
execution time (avg/stddev): 59.9578/0.00
60초동안 랜덤 쓰기 I/O (rndwr)
$ sysbench --test=fileio --file-test-mode=rndwr --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random write test
Initializing worker threads...
Threads started!
File operations:
reads/s: 0.00
writes/s: 716.43
fsyncs/s: 918.96
Throughput:
read, MiB/s: 0.00
written, MiB/s: 11.19
General statistics:
total time: 60.0145s
total number of events: 98028
Latency (ms):
min: 0.00
avg: 0.61
max: 222.50
95th percentile: 4.10
sum: 59924.15
Threads fairness:
events (avg/stddev): 98028.0000/0.00
execution time (avg/stddev): 59.9242/0.00
60초동안 랜덤 읽기/쓰기 I/O (rndrw) → 테스트용 더미 파일에 문제가 있으면 다시 생성하여 테스트 필요
$ sysbench --test=fileio --file-test-mode=rndrw --max-time=60 --file-total-size=350G run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Extra file open flags: (none)
128 files, 2.7344GiB each
350GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...
Threads started!
File operations:
reads/s: 276.83
writes/s: 184.55
fsyncs/s: 590.81
Throughput:
read, MiB/s: 4.33
written, MiB/s: 2.88
General statistics:
total time: 60.0062s
total number of events: 63016
Latency (ms):
min: 0.00
avg: 0.95
max: 193.77
95th percentile: 6.43
sum: 59925.04
Threads fairness:
events (avg/stddev): 63016.0000/0.00
execution time (avg/stddev): 59.9250/0.00
디스크 속도 벤치마크가 끝나면 cleanup 옵션으로 파일을 삭제해 정리
$ sysbench --test=fileio cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Removing test files...