David's Technical Note

How to use Jconsole for monitoring Weblogic Server 본문

Technology Solutions/1. Java Technology

How to use Jconsole for monitoring Weblogic Server

David Joo 2012. 5. 21. 18:14

How to use Jconsole for monitoring Weblogic Server

-본문서는 JDK 1.6을 기준으로 작성됨-

1. Jconsole 이란?

1. What is Jconsole ?

-  JMX(Java Management Extensions)을 사용하여 자바 플랫폼에서 구동되는 응용 프로그램 소프트웨어의 성능과 자원 소비 정보를 제공하는 자바 가상 머신을 모니터링하는 그래픽 도구

- it is a GUI tool to monitor the Java Virtual Machine, which  provide the performances and resouce usages of application software run on Java Platform with JMX

-  자바 표준 에디션 (Java SE platform) 5, 6에서 JDK(Java Development Kit)패키지에 한 프로그램으로 포함 즉, JDK 5,6 설치했으면 콘솔 실행이 가능함

Jconsole is included in the JDK Package

- Jconsoe is available in environment of  JDK 5 and over. so

-   JVM 성능, CPU, Memory등 시스템 자원의 사용 현황을 실시간 체크

it is possible to monitor the System resources such as JVM Performances, CPU, Memory and etc

- JDK 1.5 이상에서 사용

 

2.   구성 방식: Local 방식, REMOTE 방식

2. configuration: Local, Remote

2.1  Local 방식

2.1 Local

UNIX 환경에서는 Xmanager를 이용하여 개인 컴퓨터에서 모니터링 할 수 있으며 다른 특정 옵션 없이 jconsole을 실행시켜 모니터링 하고자 하는 프로세스의 ID를 이용하여 모니터링이 가능하다.

it is the method to use Process ID without some options

 

2.1.1 구성방법

- Xmanager를 이용하여 UNIX 서버에 접속한다. (이때 서버 방화벽 확인 할 것)

- connect to UNIX Server with Xmanager (Check for firewall before)

- ${JAVA_HOME}/bin/jconsole을 실행시킨다.

- run ${JAVA_HOME}/bin/jconsole

- 아래와 같이 첫 화면을 접한다.

- First page of Jconsole is shown up below

 

- Local Process – 모니터링 하고자 하는 서버의 PID를 선택하면 connect 버튼이 활성화 상태로 변한다. Connect 버튼 클릭

- Local Process - the button of connect is activated when PID of Server is selected on the popup page 

2.2  REMOTE 방식

2.2.1 구성 방법

- jmxremote.password.templatejmxremote.password로 복사하여 파일 하나 생성 한다.

copy jmxremote.password.template file to jmxremote.password file 

  ${JAVA_HOME}/jre/lib/management/jmxremote.password.template

${JAVA_HOME}/jre/lib/management/jmxremote.password

 

- jmxremote.password 파일을 열어 앞에 #을 제거한다.

- open teh jmxremote.password file and remove the simble #

###편집 부분###

controlRole R&D

monitorRole QED

##############

 

- jmxremote.password파일을

chmod 400 또는 444  jmxremote.password

로 변경한다.

- change owner and group to 400 or 444 on jmxremote.password file

 

    tips! chmod 444 jmxremote.password 파일로 변경하여도 서버 기동시 파일 권한을 변경해야 한다는 경고 문구와 함께 서버가 기동되지 않는 경우가 있다. 이때 권한을 400으로 준다.

 

- 웹로직 서버 JAVA_OPTIONS에 아래의 옵션을 추가 한다. 이때 port번호는 서버 마다 달리 구성한다.

- add JAVA_OPTIONS below 

############################jconsole#####################

JAVA_OPTIONS="-Dcom.sun.management.jmxremote

-Dcom.sun.management.jmxremote.port=8999

-Dcom.sun.management.jmxremote.ssl=false

-Dcom.sun.management.jmxremote.password.file=

${JAVA_HOME/jre/lib/management/jmxremote.password ${JAVA_OPTIONS}"

export JAVA_OPTIONS

########################################################

tips -Dcom.sun.management.jmxremote.authenticate=false 을 추가하면 원격으로 서버에 접속시 userID(controlRole or monitorRole), password가 필요 없게 된다.

tips if -Dcom.sun.management.jmxremote.authenticate=false is applied, userID and password are not required on remote connect of Server

 

-  개인컴퓨터 ${JAVA_HOME}/bin/jconsole을 실행 시킨 후 Remote Process <IP><PORT> Username Password를 입력한 후 Connect를 누른다.

3.   Jconsole 탭 별 설명

3.1 Overview

- 아래와 같이 모니터링 자 하는 서버 프로세스에 연결된 첫 화면 이다.

- Heap Memory Usage, Threads, Classes, CPU Usage 사용을 한 화면에서 볼수 있으며 더 자세히 알아보기 위해 각 해당 탭을 선택한다.

- Time Range 옵션을 통해 시간 범위에 따라 JConsole 구동 후 실시간 체크가 가능함       

- 아래 화면과 같이 그래프에서 오른쪽 마우스 버튼을 클릭하면 시간 범위 설정 및 실시간 모니터링 정보를 CSV 파일로 저장 가능함

 

3.2 Memory

- Chart를 통해 각 메모리 영역별 세부 메모리 소비량을 확인할 수 있다.

- Eden Space (heap): 대부분의 오브젝트들이 처음 할당되는 메모리 공간

- Survivor Space (heap): GC가 발생시 오브젝트가 메모리 반환되지 않고 살아남은 객체들을 위한 메모리 공간

- Tenured Generation (heap): the survivor space.에서 일정 시간 동안 여전히 살아 남은 객체들을 위한 메모리 공간

- Permanent Generation (non-heap): 클래스, 메소드 오브젝트 같은 VM의 모든 reflective data를 포함하는 메모리 공간

- Code Cache (non-heap): Native code의 저장 공간, 컴파일을 위해 사용되는 메모리 공간

   - Detail 항목

Used: 현재 사용되는 메모리량

Committed: 사용될 수 있는 가용 메모리 량

Max: 최대 메모리 량

GC time Gabage Collection을 위해 사용하는 시간

 

3.3 Thread

- 빨간색 라인: 생성된 threads의 최대 수

  파란색 라인: 구동중인 threads의 수

- Threads list: 현재 수행되는 threads의 모든 리스트를 보여준다.

- threads에서 한 thread를 선택하면 그에 대한 이름, 상태, stack trace 정보

- Detect Deadlock: deadlocked threads를 찾는 기능 제공

 

3.4 Classes

- Class loading에 대한 정보를 보여줌

- 빨간색라인: unloaded classes를 포함한 총 class의 수

      -  파란색은 로딩된 현재 classes의 수

- Verbose Output: Class loading 에 대한 trace를 세팅이 가능하며 로그 상에 기록된다.

 

3.5 VM Summary

    - Threads, classes, memory, operating system 별 정보를 한눈에 확인가능하며 실시간 값이 변경된다.

 

4.   언제 시점에 사용시 유용 할까 ?

- 성능 부하 테스트 시 실시간 모니터링을 위해 유용하다.

- 메모리 관련 장애 발생시 메모리 사용 변화 추이에 대한 파악을 위해 유용하다.