티스토리 뷰

728x90
반응형

 포스팅에서는 아파치 성능검사 도구를 이용한 기본 성능 측정방법에 대해 알아보겠습니다.


ab는 아파치 하이퍼텍스트 전송 프로토콜 (HTTP) 서버의 성능을 검사하는(benchmarking) 도구입니다. 아파치가 현재 초당 몇개의 요청을 서비스하는지 알수 있으며, HTTP Protocol을 사용하여 간편하게 성능을 측정해 볼 수 있습니다.


먼저 사용방법입니다.

ab -n [All Request Count] -c [Concurrent Client] URL

ab는 apache-utils 패키지에 포함되어 있습니다.

// -n 성능을 검사하기위해 보내는 요청수

// -c 동시에 요청하는 요청수

ex) ab -n 400 -c 200 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/session.jsp


실제 테스트를 진행해 보도록 하겠습니다.

아래 CLI 명령어는 총 400개의 요청을 한번에 1개씩 보내는 명령어입니다. while.jsp는 성능 저하를 유발하기위해 while 구문을 반복하게 짜여져 있는 jsp입니다.


결과

Client 측 ab 호출


[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 1 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 2 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 10 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 20 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 50 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 100 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ ab -n 400 -c 200 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/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 ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com (be patient)

Completed 100 requests

Completed 200 requests

Completed 300 requests

Completed 400 requests

Finished 400 requests



Server Software:        

Server Hostname:        ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com

Server Port:            8080


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)

[ec2-user@ip-172-31-22-0 ~]$ 



본 테스트의 시나리오는 전체 요청 수인 400 Request를 처리하는데 동시 요청이 1, 2, 10, 20, 50, 100, 200일 경우 성능의 변화를 모니터링하는 것에 있습니다.

ab -n 400 -c 1 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/while.jsp

요청

동시접속

총소요시간(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

결과는 위와 같이 측정되었습니다.

동시 접속자가 늘어날수록 초당 처리 속도는 대략 비슷하게 측정되었지만 400 / 200 (총 요청 수 / 동시 요청 수) 일 경우 초당 처리 요청이 가능 많았습니다.

위 표의 결과는 Single Instance의 처리 속도 아래 표의 결과는 LoadBalancer를 두고 처리할 성능지표입니다.

ab -n 400 -c 1 http://ec2-13-125-57-167.ap-northeast-2.compute.amazonaws.com:8080/while.jsp

요청

동시접속

총소요시간(Sec)

실패

초당처리속도

별처리속도(Sec)

400

200

9.163

0

43.65 2.811523

당연히 한대의 인스턴스가 너무 힘들어 할 경우 새로운 인스턴스를 똑같이 만들어 ELB에 붙이면 두대가 서비스를 하게되고, 부족하면 세대 만들고 네대 만들어 붙이면 이론적으로 무한은 없다고 볼 수 있습니다.

다만 컴퓨터가 부족할때 마다 수동으로 ELB에 붙이는 일은 쉽지 않은 일입니다. 자고 있는 동안 컴퓨터가 부족할 수도 있고, 사용자들이 막 쇄도하는 순간이 비지니스 적으로 클라이막슨데 이순간을 놓친다는 것은 너무나 슬픈일입니다.

그렇기 때문에 수동의 작업들을 완전히 자동화 해주는 오토스켈링과 ELB가 만나게 되면 엄청난 시너지 효과를 내게 됩니다.


오늘은 클라우드를 구성단 Instance의 단순 성능지표를 측정하는데 도움이 될만한 ab에 대해 살펴보았습니다.

728x90
반응형