Eclipse + TPTP Remote

Posted at 2012. 1. 20. 21:23 | Posted in Tools/Eclipse
반응형
Eclipse + TPTP (Eclipse Test & Performance Tools Platform) 에 이어서 원격지에 있는 WAS 를 프로파일링 해봅시다.

Ubuntu 11.04 32bit 에서 테스트 하겠습니다.

$ uname -a
Linux nerv.kr 2.6.38-8-generic-pae #42-Ubuntu SMP Mon Apr 11 05:17:09 UTC 2011 i686 i686 i386 GNU/Linux

http://dev.eclipse.org/viewcvs/viewvc.cgi/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/packaging_md/linux/getting_started.html?root=TPTP_Project&view=co



Setting Up Agent Controller

서버에 심어둘 Agent Controller(AC)를 다운로드 합니다.

http://www.eclipse.org/tptp/home/downloads/


다운로드 받아서 압축을 풉니다. (전 "opt/tptpAC" 에 풀었습니다.)

bin 디렉토리의 SetConfig.sh 스크립트를 한번 실행해줍니다.

1. JVM 위치 : 디폴트 값이 맞다면 그냥 엔터로 넘기시면 됩니다.
2. 네트워크 엑세스 : ALL
3. 보안 사용 : 패스

/opt/tptpAC/bin# ./SetConfig.sh
Specify the fully qualified path of "java" (e.g. /usr/java1.4/jre/bin/java):
  Default>"/usr/lib/jvm/java-6-sun-1.6.0.26/jre/bin/java" (Press <ENTER> to accept the default value)
  New value>/usr/lib/jvm/java-6-sun/bin/java
Network access mode (ALL=allow any host, LOCAL=allow only this host, CUSTOM=list of hosts):
  Default>"LOCAL" (Press <ENTER> to accept the default value)
  New value>ALL
Security enabled. (true/false):
  Default>"FALSE" (Press <ENTER> to accept the default value)
  New value>

/opt/tptpAC/bin#

Agent Controller Server 를 실행합니다. (끄는건 ACStop.sh)

/opt/tptpAC/bin# ./ACStart.sh
Starting Agent Controller.
ACServer started successfully.


Checking Agent Controller Installation

한번 테스트 해봅시다.

/opt/tptpAC/bin# ./SampleClient

Connected to the Agent Controller on "localhost" at port number 10006

The Time Collector Agent ID: 103

Established a data channel with the agent.

Sending 5 Hello messages over data channel to TimeCollector ...

Start the TimeCollector ...

Incoming data: Hello from Time Collector Agent - Count 0
Incoming data: Hello from Time Collector Agent - Count 1
Incoming data: Hello from Time Collector Agent - Count 2
Incoming data: Hello from Time Collector Agent - Count 3
Incoming data: Hello from Time Collector Agent - Count 4
Incoming data: Hello from Time Collector Agent - Count 5

Stop the TimeCollector ...

Incoming data: Hello from Time Collector Agent - Count 6
Incoming data: Hello from Time Collector Agent - Count 7
Incoming data: Hello from Time Collector Agent - Count 8
Incoming data: Hello from Time Collector Agent - Count 9

All finished
Press enter key to exit...

/opt/tptpAC/bin#

포트가 열려 있는지 확인 해봅시다.

# netstat -n -a | grep 10002
tcp6       0      0 :::10002                :::*                    LISTEN
tcp6       0      0 ***.***.***.***:10002       ***.***.***.***:50412       ESTABLISHED

# netstat -n -a | grep 10005
tcp6       0      0 :::10005                :::*                    LISTEN

# netstat -n -a | grep 10006
tcp6       0      0 :::10006                :::*                    LISTEN
tcp6       0      0 ***.***.***.***:10006       ***.***.***.***:50414       ESTABLISHED



Profiling a Java Application

이제 톰켓을 프로파일링 모드로 구동시켜 봅시다.

시작 스크립트 부분에 아래와 같이 환경변수를 세팅해 줍니다.

# 임시 디렉토리 설정(옵션)
export TEMP="/tmp"
export TMP="/tmp"

export TPTP_AC_HOME="/opt/tptpAC"
export JAVA_PROFILER_HOME="${TPTP_AC_HOME}/plugins/org.eclipse.tptp.javaprofiler"
export PATH="${JAVA_PROFILER_HOME}:${TPTP_AC_HOME}/bin:${PATH}"
export LD_LIBRARY_PATH="${JAVA_PROFILER_HOME}:${TPTP_AC_HOME}/lib:${LD_LIBRARY_PATH}"

그리고 자바 옵션에 아래와 같이 추가합니다.

프로파일링의 종류는 3가지가 있습니다.

- CGProf : Execution time analysis.
- HeapProf : Object allocation/heap analysis.
- Thread : Thread analysis.

-agentlib:JPIBootLoader=JPIAgent:server=controlled;CGProf

저의 구동 스크립트는 CATALINA_OPTS 변수를 사용하더군요 ㅎㅎ

export CATALINA_OPTS="$CATALINA_OPTS -agentlib:JPIBootLoader=JPIAgent:server=enabled;HeapProf"

※ 만약 JPIAgent 를 찾을 수 없다거나 에러가 난다면 앞뒤로 '(쿼터)를 추가해 봅시다.

OS 종류에 따라 좀 틀려서.. ㅠ_ㅠ

export CATALINA_OPTS="$CATALINA_OPTS '-agentlib:JPIBootLoader=JPIAgent:server=enabled;HeapProf'"

옵션이 제대로 박혀 들어가 있는지도 확인 해봅시다.

# ps -ef | grep tomcat6
tomcat6   5899     1  2 20:12 ?        00:01:15 /usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms256m -Xmx512m -agentlib:JPIBootLoader=JPIAgent:server=enabled;HeapProf -Djava.endorsed.dirs=/usr/share/tomcat6/endorsed -classpath /usr/share/tomcat6/bin/bootstrap.jar -Dcatalina.base=/var/lib/tomcat6 -Dcatalina.home=/usr/share/tomcat6 -Djava.io.tmpdir=/tmp/tomcat6-tmp org.apache.catalina.startup.Bootstrap start



이제 이클립스에서 원격으로 붙어서 상태를 확인 해봅시다.

물론 TPTP 플러그인은 깔려 있어야 합니다. ^^;;

Run - Profile Configurations...



Attach to Agent 를 추가하고 원격으로 볼 주소를 Default Hosts 에 추가합니다.



Agents 탭에 보면 떠있는 프로파일링이 보입니다. (바로 안보이면 Refresh 버튼 한번 클릭!)

선택 후 "Profile" 버튼을 클릭합니다.



"Profiling and Logging" 퍼스펙티브로 이동해서 보면 "Profiling Monitor" 탭에 등록한 호스트가 보일겁니다.

더블클릭해서 보면 프로파일링 결과가 나옵니다. ㅎㅎ




생각보다는 어렵지 않네요...

반응형

'Tools > Eclipse' 카테고리의 다른 글

Eclipse JVM 경로 지정하기  (0) 2016.09.13
Eclipse + SVN Plugin  (1) 2012.03.29
Maven Integration for Eclipse  (0) 2012.02.20
Eclipse + TPTP (Eclipse Test & Performance Tools Platform)  (4) 2012.01.01
Eclipse + MyBatis Generator  (1) 2011.07.04
installation Oracle Enterprise Pack for Eclipse  (2) 2011.05.22
Eclipse + STS (SpringSource Tool Suite)  (1) 2011.01.16
Eclipse Plugins for JBoss technology  (1) 2011.01.11
Properties Editor  (1) 2009.11.17
UTF-8 설정  (0) 2009.11.16
//
반응형
요즘들어 개발 자체보다는 프로파일링이나 APM 쪽에 관심이 생겼습니다.

프로파일링 툴중 하나로 TPTP 라는 것이 있길래 이것저것 해보았습니다. ^^;;

TPTP 를 이용하여 웹어플(Web Application)을 프로파일링 해보겠습니다!

http://www.eclipse.org/tptp/



http://www.eclipse.org/tptp/home/documents/tutorials/profileOnServer/TPTP-WTP.html

Eclipse 3.6 (Helios) SR2 에서 진행합니다.



Installing TPTP prerequisites

TPTP 설치 전에 필요로 하는 플러그인들이 있습니다.

1. WTP (Web Tools Platform) - http://eclipse.org/webtools/

이클립스를 J2EE 버전으로 설치했다면 포함되어 있습니다.


2. EMF (Eclipse Modeling Framework) - http://www.eclipse.org/modeling/emf/




3. GEF (Graphical Editing Frame work) - http://www.eclipse.org/gef/



Installing TPTP

이클립스를 이용하여 다운로드 하면 다운로드 진행이 안되서 전 플러그인을 다운로드 받아서 설치했습니다.

4.7.2 - http://www.eclipse.org/downloads/download.php?file=/tptp/4.7.2/TPTP-4.7.2/tptp.sdk-TPTP-4.7.2.zip



Downloading and installing the Agent Controller

TPTP 를 사용하기 위해선 AC(Agent Controller)라는 것을 심어놔야 하는데 로컬 서버는 필요 없습니다.


Setting up a Server

그냥 톰켓 7.0 으로 테스트 하겠습니다.

 



Profile a Server

이제 준비는 끝났습니다.

서버(WAS)를 시작할 때 프로파일 모드(?)로 실행하면 됩니다.



아래와 같이 팝업이 뜹니다.


실행시간(Execuion Time), 메모리(Memory), 쓰래드(Thread)를 분석Analysis할 수 있습니다.

3개중 하나를 선택 하고 "Finish" 버튼을 클릭 하면 WAS 가 기동됩니다.

기동된 후 아래와 같이 창이 뜹니다.


퍼스펙티브(Perspective)를 변경할 거냐고 물어보는데 어차피 상세내역을 보려면 변경해서 봐야하므로 아무거나 선택 ^^;;



웹어플을 이것저것 테스트한 후에 "Profilling Monitor" 뷰에서 더블클릭 하거나 "Profiling and Logging" 퍼스펙티브를 선택하여 이동합니다.




그러면 아래와 같이 각 메소드마다 처리 시간을 볼 수 있네요~

 


나머지 두가지(메모리, 쓰래드)는 각자 해보시면 되겠습니다. -_-;;

오른쪽 상단의 아이콘이나 컨텍스트 메뉴를 이용하면 이런저런 기능들이 많네요~



자기 로컬에서 하는 것은개발할 때 잠깐 켜놓는 것이기 때문에 아주 눈에 띄게 잘못된 부분이 아니면 찾아내기는 힘들 것 같습니다.

통합테스트나 할 때 개발(운영) 서버에 띄워놓고 장기간 관찰해야 진짜로 효과가 있을듯 합니다.

이제 원격지에 AC(Agent Controller)를 심어놓고 하는 방법을 공부해봐야 겠습니다. ㅠ_ㅠ

반응형

'Tools > Eclipse' 카테고리의 다른 글

Eclipse JVM 경로 지정하기  (0) 2016.09.13
Eclipse + SVN Plugin  (1) 2012.03.29
Maven Integration for Eclipse  (0) 2012.02.20
Eclipse + TPTP Remote  (1) 2012.01.20
Eclipse + MyBatis Generator  (1) 2011.07.04
installation Oracle Enterprise Pack for Eclipse  (2) 2011.05.22
Eclipse + STS (SpringSource Tool Suite)  (1) 2011.01.16
Eclipse Plugins for JBoss technology  (1) 2011.01.11
Properties Editor  (1) 2009.11.17
UTF-8 설정  (0) 2009.11.16
//