Linux ETC

부하 테스트 2편 – Web Test

2012.04.27 08:15

호스트웨이 조회 수:26662

 부하 테스트 2편 – Web Test


이번엔 하드웨어 스트레스 툴에 이어 웹 테스트 툴인 ab를 소개해 드립니다.
시스템 리소스 사용량이 아닌 웹 접속을 얼마나 받아들일 수 있는지 등의 테스트로
최대 가능한 수용 범위를 추정해볼 수 있습니다.

CPU의 처리능력과 메모리의 보조역할 HDD의 I/O 응답 속도들이 뒷받침 되어야 더 많은
양의 동시접속자도 감당할 수 있을 것입니다.
물론 잘 아실테지만, CPU와 Memory의 영향이 큽니다. 이미지 서버와 같은 경우는 하드 속도의
영향도 무시할 수 없습니다.
하여 서버에 맞는 최대치를 설정 해주어야 서버가 다운되는 현상을 방지 할 수 있습니다.


[유용한 옵션]
-n requests
      Number of requests to perform for the benchmarking session.
      The default is to  just  perform a single request which usually leads to non-representative
      benchmarking results.
     요청을 수행할 개수

-c concurrency
        Number of multiple requests to perform at a time. Default is one request at a time.
        요청을 만들 개수로 동시 사용자 개념


-v verbosity
      Set verbosity level - 4 and above prints information  on  headers,  3  and  above 
       printsresponse codes (404, 200, etc.), 2 and above prints warnings and info.
      얼마나 자세한 정보를 화면에 출력해 줄 것인지 결정

-w HTML
     Print  out  results in HTML tables. Default table is two columns wide, with a white background.
     문서형식으로 테이블로 만들어 결과를 화면에 출력

-k HTTP
     Enable  the  HTTP KeepAlive feature, i.e., perform multiple requests within one HTTP session.
     Default is no KeepAlive.
     프로토콜의 지속연결 (KeepAlive) 기능을 사용


  [사용 예제]

  형식 : ab –n 시도횟수 –c 동시접속수 http://도메인:포트번호/
  # ab -n 100 -c 30 http://www.test.com:80/

 

[root@manage ~]# ab -n 100 -c 30 http://test.com:80/

30명의 동시접속자가 test.com으로 100번 접속 시도 진행. 

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking test.com (be patient)...

..done


Server Software:        Apache/2.4.1
Server Hostname:        test.com
Server Port:            80

Document Path:          /
Document Length:        10069 bytes

Concurrency Level:      30
Time taken for tests:   48.894663 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1030700 bytes
HTML transferred:       1006900 bytes
Requests per second:    2.05 [#/sec] (mean)
Time per request:       14668.399 [ms] (mean)
Time per request:       488.947 [ms] (mean, across all concurrent requests)
Transfer rate:          20.57 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0       2
Processing:  1642 14334 13652.5   6943   41160
Waiting:     1348 13893 13308.1   6853   40811
Total:       1642 14334 13652.8   6943   41162

Percentage of the requests served within a certain time (ms)
  50%   6943
  66%  10805
  75%  31599
  80%  34003
  90%  36132
  95%  37108
  98%  41035
  99%  41162
100%  41162 (longest request)

요청이 끝나게 되면 위와 같이 요청시간 응답시간등에 대한 리포트가 보여집니다.
결과 처리가 늦어지게 되면 해당 서버의 부하로 인해 문제가 발생 할 수 있으니,
반드시 적은 값부터 조금씩 높혀가며 테스트 해보시기 바랍니다.