프로그램

수정된 ab를 활용한 동적 페이지 성능테스트

고요한하늘... 2012. 9. 26. 15:33

성능 테스트를 할때

여러가지 툴이 존재하지만 가장 범용적인 툴이 ab 이다.

apache bench의 약자인데

주로 static page에 대해서 속도 테스트를 하기 위해서 사용된다.

abc.c

 

검색쪽에서 일을 하다보니 static page보다는 dynamic page 즉 쿼리가 변하는

url에 대해서 테스트하는 경우가 더 빈번하다.

 

이런 경우 사용가능한

ab에 대해서 파일 입력을 받을수 있도록 소스수정한 내용이 웹에 있어서 소개한다.

 

http://chrismiles.livejournal.com/21720.html

해당 페이지에는 수정된 소스를 patch 하는 방법이 있는데

기존 ab는 그대로 두고 abc 라는 ab를 wrapping 한 프로그램을 하나 더 만드는 과정을 간략히 설명하면

첨부된 파일을 아파치 소스 디렉토리 support/abc.c로 옮겨 놓고

support/Makefile.in을 아래와 같이 수정한다.

 

수정전 : PROGRAMS = htpasswd htdigest rotatelogs logresolve ab checkgid htdbm httxt2dbm
수정후 : PROGRAMS = htpasswd htdigest rotatelogs logresolve ab abc checkgid htdbm httxt2dbm

 

 

 

ab 컴파일 하는 부분을 그대로 복사해 abc에 대한 컴파일 규칙을 추가한다.

수정전 : ab_OBJECTS = ab.lo
ab: $(ab_OBJECTS)
    $(LINK) $(ab_LTFLAGS) $(ab_OBJECTS) $(PROGRAM_LDADD)


 

수정후 :

ab_OBJECTS = ab.lo
ab: $(ab_OBJECTS)
    $(LINK) $(ab_LTFLAGS) $(ab_OBJECTS) $(PROGRAM_LDADD)


abc_OBJECTS = abc.lo
abc: $(abc_OBJECTS)
    $(LINK) $(ab_LTFLAGS) $(abc_OBJECTS) $(PROGRAM_LDADD)

 

abc 실행옵션

Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -t timelimit    Seconds to max. wait for responses
    -p postfile     File containing data to POST
    -R reqfile      File containing lines to append to each request URL
    -T content-type Content-type header for POSTing
    -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.
    -g filename     Output collected data to gnuplot format file.
    -e filename     Output CSV file with percentages served
    -h              Display usage information (this message)

 

-R 쿼리 리스트를 받기 위한 옵션이 추가됐다.

abc.c
0.07MB