SlideShare une entreprise Scribd logo
1  sur  15
Télécharger pour lire hors ligne
오픈소스 웹 퍼포먼스 & 로
 드 테스팅 프레임워크
    Multi-Mechanize
Multi-Mechanize
Web : multimechanize.com
PyPI : multi-mechanize package
Dev : GitHub
License : GNU LGPv3
Author : Corey Goldberg
Multi-Mechanize?
"파이썬으로 만들어진
  퍼포먼스 & 로드 테스트 프레임웍"

- 웹 성능 및 확장성 테스트에서 사용
- 원격 API에 대한 부하를 생성하는데 사용할수 있음
- 출력물은 HTML 또는 JMeter 호환 XML로 저장
설치      ( For Debian/Ubuntu Linux)

@ Linux를 위한 설치 예제입니다. 하지만, 다른 플랫폼에서도 일반적으로 설치방법과 의존성은 같습니다.




- 필수 요구사항
* Python 2.6 or 2.7


- 의존성 설치
$ sudo apt-get install python-pip python-matplotlib


- multi-mechanize 설치
$ sudo pip install -U multi-mechanize
사용방법 (1/2)

- 테스트 프로젝트 생성 : multimech-newproject

$ multimech-newproject PROJECT_PATH

생성한 테스트 프로젝트에는 아래의 파일이 존재하게 됩니다.

●   config.cfg : Multi-Mechanize의 구성 파일
    - 테스트를 위한 옵션을 설정 합니다.
●   test_scripts : 가상 유저를 위한 스크립트가 존재하는 디렉토리
    - 테스트를 위한 수행 스크립트를 등록합니다.
●   results : 테스트를 수행한 결과자료가 존재하는 디렉토리
    - 테스트를 수행하면 Timestamp형태의 이름으로 생성됩니다.
사용방법 (2/2)
- 로드 테스트 실행 : multimech-run

$ multimech-run project_path


프로젝트 내부의 results 디렉토리 안에
Timestamp 형태의 디렉토리에 결과 파일이 생성 됩니다.
Config.cfg 설정 (1/2)
Config.cfg ?
테스트 설정을 정의하는 파일로 각각의 프로젝트는 config.cfg 파일을 포함한
다.
  최소 구성 방법                   모든 구성 방법

  [global]                   [global]
  run_time = 100             run_time = 300
  rampup = 100               rampup = 300
  results_ts_interval = 10   results_ts_interval = 30
                             progress_bar = on
  [user_group-1]             console_logging = off
  threads = 10               xml_report = off
  script = vu_script.py      results_database = sqlite:///my_project/results.db
                             post_run_script = python my_project/foo.py

                             [user_group-1]
                             threads = 30
                             script = vu_script1.py

                             [user_group-2]
                             threads = 30
                             script = vu_script2.py
Config.cfg 설정 (2/2)
- global options
●   run_time : 테스트 시간 (초) [필수]
●   rampup : 사용자의 이용증가 시간(초) [필수]
●   results_ts_interval : 테스트 결과물의 시간 간격(초) [필수]
●   progress_bar : 콘솔에 테스트 진행 사항을 표시
●   console_loggin : 콘솔에 테스트 로그를 표시
●   xml_report : xml/jtl 리포트를 생성
●   results_database : 데이터베이스 커넥션 정보
●   post_run_script : 테스트가 완료된후 수행될 후킹 프로그램 설정


- user groups
●   thread : 쓰레드/가상유저 수
●   script : 가상 유저가 테스트 수행할 스크립트 파일
script (1/2)
- 각 테스트 script 파일은 반드시 Transaction() 클래스를
구현해야한다.

- Transaction 클래스는 run() 메서드를 반드시 구현해야 한
다.
class Transaction :
   def run(self) :
     # do something here



- Transaction 클래스는 인스턴스 초기화를 위해 한번 호출
되는 __init__() 메서드를 구현할수 있다.
script (2/2)
- Transaction 클래스는 인스턴스 초기화를 위해
단 한번 호출되는 __init__() 메서드를 구현할수 있다.

- run() 메서드는 반복해서 호출이 된다.

class Transaction :
   def __init__(self) :
     # this gets called once

  def run(self) :
    # this get called repeatedly
로드 테스트 (실습 1/2)
config.cfg                                             script.py
[global]                                               import mechanize
run_time = 120
rampup = 120                                           class Transaction:
results_ts_interval = 10                                        def run(self):
progress_bar = on                                                        br = mechanize.Browser()
console_logging = off                                                    br.set_handle_robots(False)
xml_report = off                                                         resp = br.open('http://www.example.com')
# results_database = sqlite:///my_project/results.db                     assert (resp.code == 200), 'Bad HTTP Response'
# post_run_script = python my_project/foo.py                             assert ('"responseCode" : 200' in resp.get_data()), 'API Returned Error'
                                                                         if '"responseCode" : 200' not in resp.get_data() :
[user_group-1]                                                                     print resp.get_data()
threads = 100                                                                      print '====='
script = v_user1.py

[user_group-2]
threads = 100
script = v_user2.py

[user_group-3]
threads = 100
script = v_user3.py
로드 테스트 (실습 2/2)

- multimech-run 실행




- multimech-run 실행 완료
로드 테스트 (결과 리포트 1/3)
통계

- 테스트 요약
- 트랜젝션 타이머
- 사용자 정의 타이머
- time-series/interval data
- count
- rate/throughput
- response time
 ● average, min, max, stdev
 ● percentiles (80, 90, 95)
로드 테스트 (결과 리포트 2/3)
그래프
 응답시간 분포도




 초당 처리량




 응답 대기시간
마치며..

Multi-Mechanize는 아래와 같은 장점을 갖음.

- 무료
- 멀티플랫폼 지원 (nix, win)
- Python 으로 구성되는 script로 Python lib를 사용 가능
- 자동 문서 생성
- 단계별 부하 생성
- 상태를 종합하여 결과 생성

Contenu connexe

Tendances

KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기
KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기
KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기흥배 최
 
Apache JMeter로 웹 성능 테스트 방법
Apache JMeter로 웹 성능 테스트 방법Apache JMeter로 웹 성능 테스트 방법
Apache JMeter로 웹 성능 테스트 방법Young D
 
Performance test using_j_meter_ver1.2
Performance test using_j_meter_ver1.2Performance test using_j_meter_ver1.2
Performance test using_j_meter_ver1.2Tommy Lee
 
AWS EC2 flask_uwsgi_nginx install guide korean
AWS EC2 flask_uwsgi_nginx install guide koreanAWS EC2 flask_uwsgi_nginx install guide korean
AWS EC2 flask_uwsgi_nginx install guide koreanJinsoo Park
 
Ubuntu에서 Flask개발 맛보기 - 1
Ubuntu에서  Flask개발 맛보기 - 1Ubuntu에서  Flask개발 맛보기 - 1
Ubuntu에서 Flask개발 맛보기 - 1Booseol Shin
 
망고100 보드로 놀아보자 5
망고100 보드로 놀아보자 5망고100 보드로 놀아보자 5
망고100 보드로 놀아보자 5종인 전
 
Apache module-201511
Apache module-201511Apache module-201511
Apache module-201511Eric Ahn
 
파이썬 스터디 15장
파이썬 스터디 15장파이썬 스터디 15장
파이썬 스터디 15장SeongHyun Ahn
 
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권freeNAVER D2
 
오픈소스 성능 최적화 보고서 ch07. Infinispan
오픈소스 성능 최적화 보고서 ch07. Infinispan오픈소스 성능 최적화 보고서 ch07. Infinispan
오픈소스 성능 최적화 보고서 ch07. InfinispanHyeonSeok Choi
 
111 n grinder-deview_day1_track1_session_1_ver_2
111 n grinder-deview_day1_track1_session_1_ver_2111 n grinder-deview_day1_track1_session_1_ver_2
111 n grinder-deview_day1_track1_session_1_ver_2NAVER D2
 
포스트모템디버깅과 프로세스 덤프 실전
포스트모템디버깅과 프로세스 덤프 실전포스트모템디버깅과 프로세스 덤프 실전
포스트모템디버깅과 프로세스 덤프 실전주항 박
 
Startup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JSStartup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JSCirculus
 
[NEXT] Flask 로 Restful API 서버 만들기
[NEXT] Flask 로 Restful API 서버 만들기 [NEXT] Flask 로 Restful API 서버 만들기
[NEXT] Flask 로 Restful API 서버 만들기 YoungSu Son
 

Tendances (19)

KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기
KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기
KGC 2016 오픈소스 네트워크 엔진 Super socket 사용하기
 
요즘웹개발
요즘웹개발요즘웹개발
요즘웹개발
 
파이선 실전공략-1
파이선 실전공략-1파이선 실전공략-1
파이선 실전공략-1
 
Apache JMeter로 웹 성능 테스트 방법
Apache JMeter로 웹 성능 테스트 방법Apache JMeter로 웹 성능 테스트 방법
Apache JMeter로 웹 성능 테스트 방법
 
Performance test using_j_meter_ver1.2
Performance test using_j_meter_ver1.2Performance test using_j_meter_ver1.2
Performance test using_j_meter_ver1.2
 
AWS EC2 flask_uwsgi_nginx install guide korean
AWS EC2 flask_uwsgi_nginx install guide koreanAWS EC2 flask_uwsgi_nginx install guide korean
AWS EC2 flask_uwsgi_nginx install guide korean
 
Performance test
Performance testPerformance test
Performance test
 
NLog 소개
NLog 소개NLog 소개
NLog 소개
 
Ubuntu에서 Flask개발 맛보기 - 1
Ubuntu에서  Flask개발 맛보기 - 1Ubuntu에서  Flask개발 맛보기 - 1
Ubuntu에서 Flask개발 맛보기 - 1
 
망고100 보드로 놀아보자 5
망고100 보드로 놀아보자 5망고100 보드로 놀아보자 5
망고100 보드로 놀아보자 5
 
Apache module-201511
Apache module-201511Apache module-201511
Apache module-201511
 
파이썬 스터디 15장
파이썬 스터디 15장파이썬 스터디 15장
파이썬 스터디 15장
 
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
[Hello world 오픈세미나]n grinder helloworld발표자료_저작권free
 
오픈소스 성능 최적화 보고서 ch07. Infinispan
오픈소스 성능 최적화 보고서 ch07. Infinispan오픈소스 성능 최적화 보고서 ch07. Infinispan
오픈소스 성능 최적화 보고서 ch07. Infinispan
 
pyOpenCL 입문
pyOpenCL 입문pyOpenCL 입문
pyOpenCL 입문
 
111 n grinder-deview_day1_track1_session_1_ver_2
111 n grinder-deview_day1_track1_session_1_ver_2111 n grinder-deview_day1_track1_session_1_ver_2
111 n grinder-deview_day1_track1_session_1_ver_2
 
포스트모템디버깅과 프로세스 덤프 실전
포스트모템디버깅과 프로세스 덤프 실전포스트모템디버깅과 프로세스 덤프 실전
포스트모템디버깅과 프로세스 덤프 실전
 
Startup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JSStartup JavaScript 8 - NPM, Express.JS
Startup JavaScript 8 - NPM, Express.JS
 
[NEXT] Flask 로 Restful API 서버 만들기
[NEXT] Flask 로 Restful API 서버 만들기 [NEXT] Flask 로 Restful API 서버 만들기
[NEXT] Flask 로 Restful API 서버 만들기
 

Similaire à Multi mechanize

C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기Heo Seungwook
 
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOSConfd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS충섭 김
 
[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들NHN FORWARD
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리YoungHeon (Roy) Kim
 
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]Jaeman An
 
Android Native Module 안정적으로 개발하기
Android Native Module 안정적으로 개발하기Android Native Module 안정적으로 개발하기
Android Native Module 안정적으로 개발하기hanbeom Park
 
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019min woog kim
 
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드 Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드 SangIn Choung
 
Boost 라이브리와 C++11
Boost 라이브리와 C++11Boost 라이브리와 C++11
Boost 라이브리와 C++11OnGameServer
 
Ji 개발 리뷰 (신림프로그래머)
Ji 개발 리뷰 (신림프로그래머)Ji 개발 리뷰 (신림프로그래머)
Ji 개발 리뷰 (신림프로그래머)beom kyun choi
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crowJaeseung Ha
 
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)Amazon Web Services Korea
 
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)Ubuntu Korea Community
 
13. Application - Tensorflow Autoencoder
13. Application - Tensorflow Autoencoder 13. Application - Tensorflow Autoencoder
13. Application - Tensorflow Autoencoder merry7
 
Sonarqube 20160509
Sonarqube 20160509Sonarqube 20160509
Sonarqube 20160509영석 조
 
[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdfHeeJung Chae
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs기동 이
 

Similaire à Multi mechanize (20)

Basic git-commands
Basic git-commandsBasic git-commands
Basic git-commands
 
C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기C++ 프로젝트에 단위 테스트 도입하기
C++ 프로젝트에 단위 테스트 도입하기
 
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOSConfd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
 
[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들[2018] Java를 위한, Java에 의한 도구들
[2018] Java를 위한, Java에 의한 도구들
 
Airflow를 이용한 데이터 Workflow 관리
Airflow를 이용한  데이터 Workflow 관리Airflow를 이용한  데이터 Workflow 관리
Airflow를 이용한 데이터 Workflow 관리
 
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]
Advanced Python Testing Techniques (Pycon KR 2019) [Korean Ver.]
 
Android Native Module 안정적으로 개발하기
Android Native Module 안정적으로 개발하기Android Native Module 안정적으로 개발하기
Android Native Module 안정적으로 개발하기
 
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019
김민욱, (달빛조각사) 엘릭서를 이용한 mmorpg 서버 개발, NDC2019
 
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드 Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
Postman과 Newman을 이용한 RestAPI 테스트 자동화 가이드
 
Boost 라이브리와 C++11
Boost 라이브리와 C++11Boost 라이브리와 C++11
Boost 라이브리와 C++11
 
Kafka slideshare
Kafka   slideshareKafka   slideshare
Kafka slideshare
 
Mylab
MylabMylab
Mylab
 
Ji 개발 리뷰 (신림프로그래머)
Ji 개발 리뷰 (신림프로그래머)Ji 개발 리뷰 (신림프로그래머)
Ji 개발 리뷰 (신림프로그래머)
 
20150212 c++11 features used in crow
20150212 c++11 features used in crow20150212 c++11 features used in crow
20150212 c++11 features used in crow
 
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
딥러닝계의 블루오션, Apache MXNet 공헌하기 - 윤석찬 (AWS 테크에반젤리스트) 오규삼 (삼성 SDS)
 
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
 
13. Application - Tensorflow Autoencoder
13. Application - Tensorflow Autoencoder 13. Application - Tensorflow Autoencoder
13. Application - Tensorflow Autoencoder
 
Sonarqube 20160509
Sonarqube 20160509Sonarqube 20160509
Sonarqube 20160509
 
[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf
 
Nodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjsNodejs, PhantomJS, casperJs, YSlow, expressjs
Nodejs, PhantomJS, casperJs, YSlow, expressjs
 

Plus de SungMin OH

Apache kafka intro_20150313_springloops
Apache kafka intro_20150313_springloopsApache kafka intro_20150313_springloops
Apache kafka intro_20150313_springloopsSungMin OH
 
Head first statistics_summary_ch03
Head first statistics_summary_ch03Head first statistics_summary_ch03
Head first statistics_summary_ch03SungMin OH
 
Head first statistics_summary_ch01
Head first statistics_summary_ch01Head first statistics_summary_ch01
Head first statistics_summary_ch01SungMin OH
 
Head first statistics_summary_ch02
Head first statistics_summary_ch02Head first statistics_summary_ch02
Head first statistics_summary_ch02SungMin OH
 
Netflix suro begins
Netflix suro beginsNetflix suro begins
Netflix suro beginsSungMin OH
 
Collaborative filtering
Collaborative filteringCollaborative filtering
Collaborative filteringSungMin OH
 

Plus de SungMin OH (8)

Apache kafka intro_20150313_springloops
Apache kafka intro_20150313_springloopsApache kafka intro_20150313_springloops
Apache kafka intro_20150313_springloops
 
Head first statistics_summary_ch03
Head first statistics_summary_ch03Head first statistics_summary_ch03
Head first statistics_summary_ch03
 
Head first statistics_summary_ch01
Head first statistics_summary_ch01Head first statistics_summary_ch01
Head first statistics_summary_ch01
 
Head first statistics_summary_ch02
Head first statistics_summary_ch02Head first statistics_summary_ch02
Head first statistics_summary_ch02
 
Netflix suro begins
Netflix suro beginsNetflix suro begins
Netflix suro begins
 
Storm begins
Storm beginsStorm begins
Storm begins
 
Hive begins
Hive beginsHive begins
Hive begins
 
Collaborative filtering
Collaborative filteringCollaborative filtering
Collaborative filtering
 

Multi mechanize

  • 1. 오픈소스 웹 퍼포먼스 & 로 드 테스팅 프레임워크 Multi-Mechanize
  • 2. Multi-Mechanize Web : multimechanize.com PyPI : multi-mechanize package Dev : GitHub License : GNU LGPv3 Author : Corey Goldberg
  • 3. Multi-Mechanize? "파이썬으로 만들어진 퍼포먼스 & 로드 테스트 프레임웍" - 웹 성능 및 확장성 테스트에서 사용 - 원격 API에 대한 부하를 생성하는데 사용할수 있음 - 출력물은 HTML 또는 JMeter 호환 XML로 저장
  • 4. 설치 ( For Debian/Ubuntu Linux) @ Linux를 위한 설치 예제입니다. 하지만, 다른 플랫폼에서도 일반적으로 설치방법과 의존성은 같습니다. - 필수 요구사항 * Python 2.6 or 2.7 - 의존성 설치 $ sudo apt-get install python-pip python-matplotlib - multi-mechanize 설치 $ sudo pip install -U multi-mechanize
  • 5. 사용방법 (1/2) - 테스트 프로젝트 생성 : multimech-newproject $ multimech-newproject PROJECT_PATH 생성한 테스트 프로젝트에는 아래의 파일이 존재하게 됩니다. ● config.cfg : Multi-Mechanize의 구성 파일 - 테스트를 위한 옵션을 설정 합니다. ● test_scripts : 가상 유저를 위한 스크립트가 존재하는 디렉토리 - 테스트를 위한 수행 스크립트를 등록합니다. ● results : 테스트를 수행한 결과자료가 존재하는 디렉토리 - 테스트를 수행하면 Timestamp형태의 이름으로 생성됩니다.
  • 6. 사용방법 (2/2) - 로드 테스트 실행 : multimech-run $ multimech-run project_path 프로젝트 내부의 results 디렉토리 안에 Timestamp 형태의 디렉토리에 결과 파일이 생성 됩니다.
  • 7. Config.cfg 설정 (1/2) Config.cfg ? 테스트 설정을 정의하는 파일로 각각의 프로젝트는 config.cfg 파일을 포함한 다. 최소 구성 방법 모든 구성 방법 [global] [global] run_time = 100 run_time = 300 rampup = 100 rampup = 300 results_ts_interval = 10 results_ts_interval = 30 progress_bar = on [user_group-1] console_logging = off threads = 10 xml_report = off script = vu_script.py results_database = sqlite:///my_project/results.db post_run_script = python my_project/foo.py [user_group-1] threads = 30 script = vu_script1.py [user_group-2] threads = 30 script = vu_script2.py
  • 8. Config.cfg 설정 (2/2) - global options ● run_time : 테스트 시간 (초) [필수] ● rampup : 사용자의 이용증가 시간(초) [필수] ● results_ts_interval : 테스트 결과물의 시간 간격(초) [필수] ● progress_bar : 콘솔에 테스트 진행 사항을 표시 ● console_loggin : 콘솔에 테스트 로그를 표시 ● xml_report : xml/jtl 리포트를 생성 ● results_database : 데이터베이스 커넥션 정보 ● post_run_script : 테스트가 완료된후 수행될 후킹 프로그램 설정 - user groups ● thread : 쓰레드/가상유저 수 ● script : 가상 유저가 테스트 수행할 스크립트 파일
  • 9. script (1/2) - 각 테스트 script 파일은 반드시 Transaction() 클래스를 구현해야한다. - Transaction 클래스는 run() 메서드를 반드시 구현해야 한 다. class Transaction : def run(self) : # do something here - Transaction 클래스는 인스턴스 초기화를 위해 한번 호출 되는 __init__() 메서드를 구현할수 있다.
  • 10. script (2/2) - Transaction 클래스는 인스턴스 초기화를 위해 단 한번 호출되는 __init__() 메서드를 구현할수 있다. - run() 메서드는 반복해서 호출이 된다. class Transaction : def __init__(self) : # this gets called once def run(self) : # this get called repeatedly
  • 11. 로드 테스트 (실습 1/2) config.cfg script.py [global] import mechanize run_time = 120 rampup = 120 class Transaction: results_ts_interval = 10 def run(self): progress_bar = on br = mechanize.Browser() console_logging = off br.set_handle_robots(False) xml_report = off resp = br.open('http://www.example.com') # results_database = sqlite:///my_project/results.db assert (resp.code == 200), 'Bad HTTP Response' # post_run_script = python my_project/foo.py assert ('"responseCode" : 200' in resp.get_data()), 'API Returned Error' if '"responseCode" : 200' not in resp.get_data() : [user_group-1] print resp.get_data() threads = 100 print '=====' script = v_user1.py [user_group-2] threads = 100 script = v_user2.py [user_group-3] threads = 100 script = v_user3.py
  • 12. 로드 테스트 (실습 2/2) - multimech-run 실행 - multimech-run 실행 완료
  • 13. 로드 테스트 (결과 리포트 1/3) 통계 - 테스트 요약 - 트랜젝션 타이머 - 사용자 정의 타이머 - time-series/interval data - count - rate/throughput - response time ● average, min, max, stdev ● percentiles (80, 90, 95)
  • 14. 로드 테스트 (결과 리포트 2/3) 그래프 응답시간 분포도 초당 처리량 응답 대기시간
  • 15. 마치며.. Multi-Mechanize는 아래와 같은 장점을 갖음. - 무료 - 멀티플랫폼 지원 (nix, win) - Python 으로 구성되는 script로 Python lib를 사용 가능 - 자동 문서 생성 - 단계별 부하 생성 - 상태를 종합하여 결과 생성