[Tool] nGrinder 찍먹 (1) - nGrinder와 설치 이야기
오늘은 nGrinder에 대해 간략히 알아보고 mac m1 환경에서 nGrinder를 설치 후 동작을 점검해보려고 합니다. 이 글은 시리즈로 연재됩니다.
nGrinder 찍먹 시리즈
nGrinder
nGrinder is a platform for stress tests that enables you to execute script creation, test execution, monitoring, and result report generator simultaneously. The open-source nGrinder offers easy ways to conduct stress tests by eliminating inconveniences and providing integrated environments.
-> README
nGrinder는 네이버에서 만든 오픈 소스로 서버의 부하 테스트를 위한 도구이다.
https://github.com/naver/ngrinder?tab=readme-ov-file
GitHub - naver/ngrinder: enterprise level performance testing solution
enterprise level performance testing solution. Contribute to naver/ngrinder development by creating an account on GitHub.
github.com
readme를 읽어보면 확인할 수 있는 링크에서 ngrinder의 아키텍처와 철학에 대해서도 알 수 있다.
https://github.com/naver/ngrinder/wiki/Architecture
Architecture
enterprise level performance testing solution. Contribute to naver/ngrinder development by creating an account on GitHub.
github.com
nGrinder의 Philosophy
- Reliability over Accuracy: 정확성보다 신뢰성
- TPS over VUser: VUser를 통한 TPS
- Code is always better than GUI Editor: 코드는 항상 GUI 편집기보다 낫다.
- Do not limit!!: 제한하지 마라!!
- File System is faster than DB if we use it correctly.: 파일 시스템은 올바르게 사용하면 DB보다 빠르다.
- Convention over Configuration: 구성에 대한 협약
- Open Closed policy by Plugin Model: 플러그인 모델별 Open Closed 정책
- One shot Installation: 한방 설치
- Need to add code? Remove same amount of code first.: 코드를 추가해야 하나요? 먼저 동일한 양의 코드를 제거하세요.
nGrinder의 Architecture
nGrinder는 여러 대의 머신에서 jython(jvm에서 돌아가는 python) 언어로 작성된 테스트 스크립트를 실행하기 위한 어플리케이션이다.
nGrinder는 Grinder의 콘솔과 에이전트를 각각 컨트롤러와 에이전트로 래핑하고 여러 기능을 확장하여 여러 동시 테스트를 가능하게 한다.
컨트롤러는 성능 측정을 위한 웹 인터페이스를 제공하면서 테스트의 프로세스를 조정하는 역할을 한다. 또한, 테스트의 통계를 대조하고 표시할 수 있으며 사용자가 스크립트를 생성하고 수정할 수 있다.
에이전트는 에이전트 모드에서 실행될 때 대상 컴퓨터에 로드를 추가하는 프로세스 및 스레드를 실행시킨다. 모니터 모드에서 실행 시에 타겟의 시스템 성능(CPU / 메모리)을 모니터링할 수 있다. 컨트롤러의 지시를 통해 여러 개의 에이전트들이 일시에 타겟 서버로 부하을 발생시키는 역할을 한다.
또한, nGrinder 3.1 버전부터는 Clustering을 도입하였고 동일한 DB와 파일 시스템을 공유하여 테스트를 진행할 수 있게 되었다.
nGrinder 설치
본인의 환경은 mac m1 환경입니다. nGrinder Release Page에서 직접 받아 사용할 수도 있지만 관리 상의 이점을 가지기 위해 docker를 통해 받아보려고 합니다.
https://github.com/naver/ngrinder/releases
Releases · naver/ngrinder
enterprise level performance testing solution. Contribute to naver/ngrinder development by creating an account on GitHub.
github.com
docker 기반 nGrinder 설치
docker hub에서 ngrinder를 검색해보았다. agent와 controller가 등장한다.
nGrinder Controller Image run
먼저 controller를 받아보기 위해 로컬 docker 환경에서 controller image를 받아보자. 오른쪽의 Docker Pull Command Copy!!
docker pull ngrinder/controller
docker에서 실행시켜 보자.
## ubuntu
docker run -d -v ~/ngrinder-controller:/opt/ngrinder-controller -p 80:80 -p 16001:16001 -p 12000-12009:12000-12009 ngrinder/controller
## apple chip
docker run -d --platform linux/amd64 -v ~/ngrinder-controller:/opt/ngrinder-controller --name controller -p 80:80 -p 16001:16001 -p 12000-12009:12000-12009 ngrinder/controller
- run : 실행
- -d: 백그라운드 실행 옵션
- -v <호스트 경로>:<컨테이너 경로>: ngrinder-controller 디렉토리를 docker 컨테이너 상의 /opt/ngrinder-controller랑 연결하여 공유함.
- -p 80:80: GUI Admin 연동을 위해 80 port랑 컨테이너의 http 통신을 위한 80이랑 연결(Spring 사용시 80이 아닌 다른 포트 사용 권장)
- -p 16001:16001: Controller 연동을 위한 포트 연결
- -p 12000-12009:12000-12009: Agent 10대 사용을 위한 12000~12009 연결
- --platform linux/amd64: apple chip의 경우 docker build 호환성 platform 차이 이슈가 있다.
m1이라 linux와 m1칩의 호환성 이슈가 있는 것 같다. 이 증상은 m1에서 SpringBoot Application을 Build한 후 EC2 Ubuntu Server에서 docker를 통해 올리려 했을 때도 같은 이슈가 있었다. warning이 뜨지만 현재는 작동을 잘한다.
-> 이를 해결하기 위해서 platform에 대한 옵션을 넣어준다.
http://localhost/login으로 접속시에 다음과 같은 controller 화면이 보이게 된다.
최초 아이디 비밀번호는 다음과 같다.
어드민 계정
- 계정 id: admin
- 계정 pw: admin
로그인을 하면 홈화면이 있다!
nGrinder Agent Image run
설치의 경우 위에서처럼 pull을 하는 것이 아니라 바로 run을 하게 되면 다음과 같이 설치가 되기도 한다.
localhost의 controller를 바라봐야하므로 127.0.0.1:16001로 바라보도록 설정했다.
docker run -d --platform linux/amd64 --name agent --link controller:controller ngrinder/agent
이제 브라우저에서 확인해보면 연결된 agent를 확인할 수 있다. 우상단의 admin을 클릭해 에이전트 관리로 들어가보자.
Script 작성
이제 본격적으로 테스트를 위한 Script를 작성은 다음 글에 진행..
끗
벌써부터 사용할 생각에 방끗
테스트란 늘 어렵다.