본문 바로가기
etc

nGrinder를 사용한 REST 부하 테스트

by 돈코츠라멘 2020. 2. 12.

/주의/ 일 년 전에 회사에서 REST 서버 부하 테스트를 진행하면서 메모 용도로 저장해둔 글입니다. 아무래도 글을 쓴 시점이 일 년 전이다 보니 현재 버전과 차이가 있을 수 있습니다.

 

nGrinder

네이버에서 성능 측정 목적으로 jython(JVM위에서 python이 동작)으로 개발 된 오픈소스 프로젝트이다. (The Grinder라는 오픈소스를 기반으로 개발되었다.)

github url: https://github.com/naver/ngrinder/

 

naver/ngrinder

enterprise level performance testing solution. Contribute to naver/ngrinder development by creating an account on GitHub.

github.com

 

components

nGrinder consists of two major components.

nGrinder controller

  • a web application that enables the performance tester to create a test script and configure a test run
  • WAR 형태의 Web application
  • performance testing(=부하테스트)를 위해 web interface 제공한다.
  • 테스트 결과를 수집해서 통계를 제공한다.

nGrinder agent(Controller의 명령을 받아 실행)

  • a virtual user generator that creates loads.
  • java application
  • agent 모드가 실행될 때, target이 된 머신에 부하를 발생시킨다.
  • monitor 모드가 실행되면 대상 시스템의 CPU와 Memory를 모니터링한다.

 

실행

controller 실행

아래 방법 중 원하는 방법으로 실행한다.

(1) standalone으로 실행

  1. nGrinder war 파일 다운로드
  2. 실행 (default port:8080)
java -XX:MaxPermSize=200m -jar ngrinder-controller-3.4.1.war -p 8083

-p 옵션: 이미 8080 port를 사용하고 있을 때 다른 port를 사용하도록 지정한다.

(2) Tomcat에 배포해서 실행

agent 다운로드 후 실행

  1. 브라우저에서 agent 다운로드
    • 브라우저에서 실행 (접속정보: admin/admin)
    • 로그인 후 오른쪽 상단에 admin>Download agent로 agent 다운로드한다.
  2. agent는 tar 파일로 다운로드된다.
  3. 다운로드한 agent를 마찬가지로 cmd에서 실행한다.
./run_agent.sh

 

Test

Script 생성

Create Script

  • 사용 가능한 Script: Groovy, jython, Groovy Maven Project
  • Script 이름, GET/POST 요청 선택, url을 입력

  • 일부가 자동으로 생성된 script -> 추가할 내용이 있으면 추가한 후 저장한다.

Test 실행

Create Test

Test 설정

Agent의 수, 실행 주기, 실행 횟수, 실행 Script 등을 설정한다.

  • Vuser per agent: agent별 가상 사용자
  • (참고) Vuser = agent * processes * thread
  • Process, Thread count는 Vuser 설정 오른쪽의 [+] 버튼을 누르면 각각 지정할 수 있다.
  • Agent: Controller와 연결되어 있는 Agent의 수만큼 사용할 수 있다.
  • Duration(기간)/Run Count(실행 횟수): 테스트 기간과 실행 횟수 중 하나만 골라 실행할 수 있다.
  • Ramp_Up: 점차적으로 부하를 가할 수 있는 기능이다. Process 또는 Thread의 수를 Interval(ms 단위)마다 Incremental Step만큼 늘릴 수 있다.

Test

댓글