레이블이 nGrinder인 게시물을 표시합니다. 모든 게시물 표시
레이블이 nGrinder인 게시물을 표시합니다. 모든 게시물 표시

2015년 7월 25일 토요일

nGrinder 3.3 with Ubuntu 14.04.1 LTS [Part - 2 Advance - (Subtitle - Agent Clustring, Memory setting)]

nGrinder 3.3 with Ubuntu 14.04.1 LTS [Part - 2 Advance - (Subtitle - Agent Clustring, Memory setting)] 


Part-1 Basic을 읽고 오셨다면 느끼셨겠지만
언제 어디서나 인터넷만 존재한다면 개발환경과도 무관하게 테스트를 바로 진행 할 수 있으니 JMeter에서 사용하던 remote control 의 불편함을 해소하고,  WAS기반으로 테스트를 진행한다는것은 가히 매력적이라고 할수 있습니다.

또한 자동으로 테스트 결과를 저장해 준다는것 또한 매력적입니다.

Part-2에서 다루게 될 Moniter기능과 Agent Clustering까지 적용한다면 
손쉽게 테스트를 진행하고, target server의 자원을 체크할수 있으니 단순히 TPS 또는 response time 측정 뿐만이 아닌 목표로 하는 서버 scale up에도 적절히 활용 할수 있을 것 입니다.

If you're here to read, but feel Part-1 Basic
Internet anywhere, anytime, if there is only development environment, and it may also be conducted regardless of the test immediately relieve the discomfort of a remote control that was used in JMeter, and proceed with the test is that it WAS based on the notch can be called attractive.

Giving is also an attractive addition to automatically save the test results.

If applied to the Agent Clustering Moniter function and be covered in Part-2
Easily proceed to test, target server, so you can check the resources of the TPS or simply by measuring response time servers that scale up to the target, not only you will be able to properly utilize.


nGrinder Controller(war가 배포된 tomcat)을 실행하거나
nGrinder Agent, nGrinder Moniter를 실행할경우

/home/{user}/ 하위에 설정 파일이 자동으로 생성됩니다.

Run the nGrinder Controller (war is deployed tomcat) or
nGrinder Agent, if you run the nGrinder Moniter

/ home / {user} / settings file is created automatically in the child.

Controller -> .ngrinder
Agent       -> .ngrinder_agent
moniter    -> .ngrinder_agent




Agent와 moniter가 .ngrinder_agent 라는 같은 이름으로 생성 된다고 해서 혼동이 발생할 일은 없습니다. moniter는 target server에 배포하고, agent는 attack server에 배포하기 때문에 같은곳에 존재 할 일이 없기 때문입니다.

local에서 Agent를 실행했을때는 별다른 설정 없이 controller와 연동이 되었지만, Clustering을 할때는 약간의 편집을 해 주어야 합니다.

Agent and moniter does not work cause confusion generated by that same name .ngrinder_agent. moniter is deployed on target server and, agent, because there is no work to do at the same place, because they are deployed to attack server.

When you run the Agent from the local controller and the works, but without any settings, you have to edit some halttaeneun for Clustering.


nGrinder 개발팀의 리더이신 윤준호님께서 직접 작성한 글을 인용하자면 아래와 같습니다.
원문 : http://junoyoon.tistory.com/108
Yun Junho's leader, who had a team nGrinder following quote posts directly.
Source: http://junoyoon.tistory.com/108
---------------------------------------------------------------------------------------------------------------
  • Controller : Oracle JDK 1.6 이상 / 톰캣 6.X 이상  / 메모리 2G 이상 권장
  • Agent : Oracle JDK 1.6 이상 / 2 Core - 메모리 4G 권장
  1. nGrinder 컨트롤러는 메모리를 많이 쓰기 때문에 메모리 설정이 좀 필요합니다. 다음 설정을 안하시면 몇가지 관리자 기능이 동작하지 않게 됩니다. 톰켓의 bin/catalina.sh (리눅스 사용시) 또는 bin/catalina.bat (윈도우즈 사용시) 에 다음을 넣으세요. 맨 앞에 넣으시면 됩니다. 
    ?
    1
    JAVA_OPTS="-Xms600m -Xmx1024m -XX:MaxPermSize=200m"    # for catalina.sh
    ?
    1
    set JAVA_OPTS=-Xms600m -Xmx1024m -XX:MaxPermSize=200m   # for catalina.bat
Controller: Oracle JDK 1.6 or higher / Tomcat 6.X or higher / Memory 2G or more recommended
Agent: Oracle JDK 1.6 or later / 2 Core - 4G memory recommended
nGrinder controller requires little memory settings, so write a lot of memory. If you do not have some of the following settings: Administrator function will not work. Put the following in bin / catalina.sh (using Linux) or bin / catalina.bat (using Windows) on Tomcat. The simyeon put it at the front.

---------------------------------------------------------------------------------------------------------------

1.Controller Setting


우선 다양한 기능들을 사용하기위해 Controller(tomcat)의 메모리부터 수정하겠습니다.

/{TOMCAT_HOME}/bin/ 경로로 가셔서
linux의 경우 catalina.sh / windows의 경우 catalina.bat을 애용하시는 편집기로 편집하시면 됩니다.
입력 위치는 크게 상관 없는걸로 알고있지만 저는 97번째 줄에 넣곤 합니다.

First, we will modify from the memory of the Controller (tomcat) to use various functions.

/ {TOMCAT_HOME} go to / bin / path
For the case of linux catalina.sh / windows please edit in your favorite editor and catalina.bat.
Enter location is largely irrelevant, but I understand we neotgon the 97th line.


윤준호씨가 권장한 설정
Mr. Yun Junho recommended settings

1
JAVA_OPTS="-Xms600m -Xmx1024m -XX:MaxPermSize=200m"

제가 사용하고 있는 설정.
I use that setting.

1
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms512m -Xmx1536m 
-XX:NewSize=128m -XX:MaxNewSize=256m -XX:PermSize=128m -XX:MaxPermSize=1024m -XX:+DisableExplicitGC"

아래와 같은 명령어로 실행하여 백그라운드로 실행 하십시오.
nohup {command} &
당신의 터미널이 종료 되어도 동작합니다.

ex)nohup ./startup.sh &

종료시키는 방법은 직접 PID를 조회 해서 process kill 해야합니다.

Run the following command to run in the background.
nohup {command} &
This works even if you exit the terminal.

ex) nohup ./startup.sh &

How to terminate the query directly to the PID must process kill.

(search tomcat pid)
ps -aux|grep tomcat

(kill tomcat process)
kill -9 [PID]

2.Agent Setting


최초 Agent를 실행하면
/{userHome}/ 경로 아래에 .ngrinder_agent가 생성됩니다.

Agent를 실행한 적이 없다면 Agent 폴더 안에 __agent.conf를 편집하시고
Agent를 실행한 적이 있다면 .ngrinder_agent 폴더안에 agent.conf를 편집하세요.

.ngrinder_agent/agent.conf가 {agent_home}/__agent.conf보다 우선 적용됩니다.

When you first run the Agent
/ {userHome} / path will be created under .ngrinder_agent.

If you have not run the Agent in Agent folder and edit the __agent.conf
If you have run the Agent to edit the agent.conf in .ngrinder_agent folder.

.ngrinder_agent / agent.conf the {agent_home} / overrides __ agent.conf.


1
2
3
4
5
6
7
8
9
10
11
12
common.start_mode=agent
#You`re WAS IP
agent.controller_host=111.222.333.444
agent.controller_port=16001
#anything
agent.region=TestRegion
#agent_ID_code
agent.host_id=anything

에이전트 또한 controller와 마찬가지로 백그라운드로 구동합니다.
Agents also drive and controller, like the background.

nohup ./run_agent.sh &

여기까지 완료되었다면 WAS에 접속해서 중간 점검을 해보도록 합니다.
Once complete, up here to try to connect to WAS intermediate check.



admin tab -> Agent Management Tab으로 들어갑니다.
admin tab -> enter the Agent Management Tab.

현재 활성화된 Agent를 볼수 있습니다.
가장 우측에 Approved 설정 부분에 모든 Agent가 Approved 되어 있는지 확인하세요.

You can view the currently active Agent.
Make sure that the Agent has all the right parts are set to Approved Approved.





3.Moniter Setting


모니터 설정은... 그냥 실행만 하면됩니다 :D
Monitor settings ... just simply run :D

nohup ./run_moniter.sh &






자 그럼 실제로 테스트를 하나 진행 해보도록 하죠.
So I actually tested one going to try.


1. Agent 설정창 Max가 2로 증가된것을 확인할 수 있습니다.
2. +버튼을 누르면 Agent의 process개수와 Thread개수를 조절할 수 있습니다.
3. Script코드를 선택할수 있습니다.
4. Add버튼을 눌러 Target Server를 monitering 할수 있습니다.
    (물론 Target Server에서 moniter가 구동 중이어야 합니다.)
5.Agent가 Thread단위로 실행 할 것인지. Process단위로 실행 할 것인지 결정합니다.
  Part-1 Basic에서 말했던 것처럼 Process는 자원 소모가 많아서 저는 Thread로 실행합니다.

1. Agent window, you can see that Max is increased by two.
2. Press the + button to adjust the process and Thread Count The number of Agent.
3. You can select the Script code.
4. Click the Add button can be monitering the Target Server.
     (Of course, you should moniter is being driven from the Target Server.)
5.Agent is whether to run as a Thread Unit. Decide if you want to run the Process Unit.
   As mentioned in Part-1 Basic Process is executed by the resources consumed much I Thread.


Target Host Add버튼을 누르면 아래와 같은 창이 뜹니다.
Pressing the Target Host Add button brings up the following window.

바로 테스트를 시작해 보겠습니다.
Let's start the test immediately.












화면에 보이는것처럼 좌측에 Target State와 Agent State를 표시해줍니다.
It displays the Target State and Agent State on the left as shown in the screen.






Test Result을 보면 Moniter된 서버의 시간대별 CPU/memory 사용량을 확인 할 수 있습니다.
In the Test Result can be checked hourly CPU / memory usage of the server Moniter.



Part-2 Advance는 이것으로 마치고
Part-3 Ultimate에서는 JMeter + nGrinder 복합사용을,
Part-4 Unlimited 에서는 Controller Clustering을 다룰 예정입니다.(물론 쓰게 된다면 말이죠.)

Part-2 Advance is finished with it
Using JMeter + nGrinder complex in Part-3 Ultimate,
In Part-4 Unlimited will cover the Controller Clustering. (. If time permits, of course)

nGrinder 3.3 with Ubuntu 14.04.1 LTS [Part - 1 Basic]

nGrinder 3.3 with Ubuntu 14.04.1 LTS [Part - 1 Basic]


nGrinder는 한국의 NHN사에서 grinder 를 확장하여 만든 오픈소스입니다.
오픈소스의 공개 범위는 제가 아는바로는 .class 파일을 제공하며,
커스터 마이징은 plug-in 개발을 통해서 가능합니다.

nGrinder is made open source by extending the grinder from NHN Corporation of Korea.
Disclosure of Open Source As far as I know, and providing a .class file,
Custer customization is available through the plug-in development.


grinder를 확장하여 만든 오픈소스 인만큼 grinder의 소개를 하자면
grinder역시 JMeter와 같은 부하 테스트 툴이며 차이점은
JMeter는 간단한 테스트를 쉽고 빠르게 만들수 있다는 것이고,
grinder는 jython(Java + python) language를 이용하여 스크립트 코드를 작성하는 방식으로써
JMeter에 비해 다소 무겁지만 세세한 컨트롤을 할수 있다는 점 입니다.

NHN에서 만든 nGrinder는 jython 뿐만 아니라 groovy , groovy+maven을 지원하며,
가장 핵심은 WAS기반으로 동작한다는 것 입니다.

gritty grinder by the introduction of open source is created by extending the grinder
grinder load testing tools such as JMeter is also the difference
JMeter will create a simple test that quickly and easily,
grinder as a way to create a script code using a jython (Java + python) language
The fact that only a little heavier than the fine control JMeter.

The nGrinder is made from NHN jython, as well as support for groovy, groovy + maven,
The most important is that the WAS-based operations.


공식 홈페이지 - http://naver.github.io/ngrinder/
nGrinder의 아키텍쳐는 다음과 같습니다.

Official Website - http://naver.github.io/ngrinder/
nGrinder architecture is as follows:


그림 1-1 nGrinder Architecture 
- http://www.cubrid.org/wiki_ngrinder/entry/general-architecture


Controller -  WAS를 통해 UI기반으로 동작합니다.
Agent       - 테스트 코드를 수행할 Worker개념입니다.
Monitor    - 해당 Target server에 설치함으로써 테스트시에 단순히 TPS나 response time측정
                    뿐만이 아닌 Target server 자원사용량(CPU / memory)을 체크합니다.

Controller - action based UI through the WAS.
Agent       - A Worker concept to perform the test code.
Monitor   - simply measure the TPS and response time during the test by installing the                        appropriate Target server Check Target server resource usage 
                   (CPU / memory) and not only.



이번 장에서는 controller와 Agent를 한 컴퓨터에서,
그리고 Target server에서 Monitor를 구동 시키는 것을 실습 하도록 하겠습니다.

공식 다운로드 페이지로 이동하여 ngrinder-controller-3.3.war 을 다운로드 받으세요.

공식 다운로드 페이지 - http://sourceforge.net/projects/ngrinder/files/
경고 : 이 예제는 nGrinder 3.3으로 진행함으로 꼭 3.3을 다운로드 받으시길 바랍니다.

In this chapter, the controller and the Agent on a computer,
And let's practice that driving the Monitor from the Target server.

Go to the official download page Download the ngrinder-controller-3.3.war.

The official download page - http://sourceforge.net/projects/ngrinder/files/
Warning: This example is hope just download the 3.3 by going to nGrinder 3.3.


다운로드 받은 war파일을 원하는 WAS에 배포 하시면 됩니다.

붙임말 : 공식적으로 nGrinder는 우분투에서 정상 작동을 보장하지 않으며 CentOS/Windows계열에서 정상 작동을 한다고 하였습니다. 그러나 이 글은 ubuntu 14.04.1 LTS 버전에서 구동 시킨 경험을 포함하고 있으므로 주의깊게 따라오길 바랍니다.

apt-get install로 설치한 tomcat 7.x에서는 정상 구동 되지 않았습니다.
직접 tomcat 7.x소스 파일을 다운받고 /webapps/ROOT 에 배포 하였으며.
auto deploy가 되지 않아 ROOT 밑에서 직접 압축을 풀었습니다.

If you deploy a war file is downloaded to the desired WAS.

Attachment to say: that the summit was officially nGrinder works on CentOS / Windows-based does not guarantee the normal work in Ubuntu. However, because this article includes a driving experience that in ubuntu 14.04.1 LTS version, please come along carefully.

In tomcat 7.x installed by apt-get install is not normal driving.
Tomcat 7.x to download the source files directly under / webapps / ROOT was deployed to.
I do not have auto deploy unpacked directly underneath the compression ROOT.


혹시나 하는 마음에 war 수동배포 소스 첨부합니다.
it`s tip not support eglish 
please search 'war deploy on linux'
---------------------------------------------------------------------------------
원본 출처 - http://jp1020.tistory.com/entry/linux-war-%EC%95%95%EC%B6%95%ED%92%80%EA%B8%B0

리눅스 압축풀기
WAR 파일 만들기
1. command line 상에서 WAR파일을 만들고자 하는 폴더로 이동
2. jar cvf <war파일이름>.war *  입력
   (예 : jar cvf test.war *)
3. 해당 폴더내에 war파일 생성완료

WAR 파일 압축풀기
1. command line 상에서 WAR파일이 있는곳으로 이동
2. jar xvf <war파일이름>.war 입력
   (예 : jar xvf test.war)
3. 해당 폴더내에 압축이 풀림

* 만약 해당 폴더가 아닌 다른 폴더에 압축을 풀고 싶다면
1. 압축을 풀고자 하는 폴더를 만들고 command line에서 폴더(BD)로 이동 
2. jar xvf <절대/상대path + war파일이름>.war 입력
   (예 :jar xvf /lnjdev/web_home/BD.war)
3. 해당 폴더내 압축이 풀림
---------------------------------------------------------------------------------


deploy후 was를 start 시키고 접속해보면 다음과 같은 화면을 볼수 있습니다.
When was the start-up and after deploy you can see the following screen.


그림 1-2

초기 id / password는 admin / admin입니다.
The default id / password is admin / admin.








로그인후에 다음과 같은 화면을 볼수 있습니다.
After login, you can see the following screen.

그림 1-3

1번은 테스트 진행 영역
2번은 Test Script 작성 영역
3번은 Agent와 Moniter 다운로드 영역입니다.
3번의 2가지 모두 다운로드 하시고 JDK 6이상의 버전을 설치 해 주십시오.

ngrinder-agent는 독립적으로 실행되며 
리눅스의 경우 run_agent.sh / 윈도우의 경우 run_agent.bat 을 실행하면 됩니다.

# 1 progress test area
# 2 Test Script writing area
# 3 Agent and Moniter download area.
Download all three two kinds of prices, please install the JDK 6 or later.

ngrinder-agent runs independently
For the case of Linux run_agent.sh / Windows, you can run the run_agent.bat.

2번 스크립트를 눌러 첫번째 스크립트를 작성 해보도록 하겠습니다.
Click the tab labeled 2 script will be to try to create the first script.


그림 1-4

Create a script버튼을 누르면 아래와 같은 창이 뜹니다.
Pressing the button brings up the following window Create a script.

그림 1-5

스크립트 작성 언어는 총 3가지를 지원합니다.
1.Groovy
2.Jython
3.Groovy Maven Project

이번 예제는 Groovy로 작성 하도록 하겠습니다.

Create a script language supports a total of three.
1.Groovy
2.Jython
3.Groovy Maven Project

For this example we will be creating in Groovy.




그림 1-6

처음 Groovy Script를 생성하면 기본적인 GET 호출 스크립트가 작성됩니다.
이 예제에서는 target server를 naver로 설정하고 저장합니다.
(Groovy 또는 Jython language에 대한 설명은 논외 이므로 이 글에서 다루지 않습니다.)

When you first create a Groovy Script basic GET call script is written.
This example sets the target server and storage naver.
(For an explanation of the Groovy or Jython language is beyond the scope of this article, so the question, though.)






그림 1-7
Performance Test탭으로 이동하여 Create Test 버튼을 클릭합니다.
Go to the Performance Test tab and click the Create Test button.




그림 1-8

1.Test Name을 적는 란 입니다.
2.Agent -작업할 Agent수를 설정합니다. 
  -현재 local에서 1개의 Agent만 실행하였으므로 Max가 1이 정상입니다.
    Clustering은 Part-2 Advance에서 다룹니다.
3.Vuser per agent - 동시 접속자를 설정합니다.
4.Script - 테스트할 스트립트를 선택합니다.
5.Target Host 
   - Target Server에 moniter를 구동시킬경우 사용 가능한 기능입니다.
     이 내용은 Part2- Advance에서 다룹니다.
6.Procecss 
   Process or Thread로 설정 가능합니다.
   Process는 자원 소모량이 많기 때문에 Thread가 낳은 감이 있지만 
   간단한 테스트 이므로 Process로 실행합니다.
7.Save and Start - 저장 및 실행 버튼입니다.

The detailing is 
1.Test Name.
2.Agent - Sets the number of Agent to work.
   - Only one Agent in the current local execution hayeoteumeuro Max 1 is normal.
     Clustering is covered in Part-2 Advance.
3.Vuser per agent - sets of concurrent users.
4.Script - Select the script you want to test.
5.Target Host
    - This function is available if you can drive a moniter on Target Server.
      This is covered in Part2- Advance.
6.Procecss
    You can set Process or Thread.
    Process this sense is born is consumption of resources, but because there are a lot of      Thread Since a simple test to run in Process.
7.Save and Start - The Save and Run button.


위에 세팅한 내용대로 테스트를 실시 해 보겠습니다.
Information set as above, let's conduct a test.



그림 1-9

Start 버튼을 누를경우 Run Now(즉시 실행) 과 Schedule(예약)을 할수 있습니다.
Run Now(즉시 실행)을 해보겠습니다.
If you press the Start button can be a Run Now (Immediate) and Schedule (reservation).
I will try the Run Now (Immediate).




그림 1-10

테스트 진행과정이 실시간으로 표시되며 좌측 하단에 Agent State 즉 부하 테스트를 위해 Agent가 실행되고 있는 PC의 자원을 표시해 줍니다.
Test progress is displayed in real time and will display the resources of the PC Agent is running for the Agent State means that a load test on the bottom left.






그림 1-11

테스트 완료후 Summary Report를 바로 볼수 있으며, Detailed Report버튼을 클릭하여
상세 내용을 확인 할 수 있습니다.
After completing the test and see just a Summary Report, click on the Detailed Report button You can check the details.



그림 1-12


가장 기초적인 nGrinder 사용 방법이었습니다.


Agent Clustering , Moniter 구동은 Part-2 Advance에서 다루도록 하겠습니다.

The most basic way nGrinder was used.
Agent Clustering, Moniter drive, we will be discussed in Part-2 Advance.