A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)

阅读更多
jvmstat 3.0 can monitor J2SE 5.0, J2SE 1.4.2 and J2SE 1.4.1 virtual machines,
jvmstat3.0 need JDK5.0 installed, for those cannot upgrade to JDK5.0,pls find the previous version in:
1.1:
Reference[3]
2.0:
Reference [4]
Actually you can find them in the jvmstat FAQ point 11.

1: Install and setup
For installation and setup problem pls refer to reference[1], the installation part.

2: Simple test
a) Test in local
For local test, here choose the Java2DDemo to demonstrate the usage of jps/jstat/visualgc

After the installation finished,
<1>Start the Java2DDemo swing java application
C:\>java -jar "C:\Program Files\Java\jdk1.5.0_06\demo\jfc\Java2D\Java2Demo.jar
<2> use jps to find the PID of the Java2DDemo, or you can find the PID in windows task manager.
C:\>jps
5964 Program
5596 Jps

there is always has the Jps process. here the 5964 is PID of the Java2DMemo java application
<3> get the GC status by jstat and pipeline to a file to PID 5964, with 1000ms intervals and 1000 times.
C:\>jstat -gcutil 5964 1000 1000 >> c:\gc.log
for the usage of jstat you can get help by jstat -help and jstat -options

<4> Visual monitor the GC with visualgc
C:\>visualgc 5964
You will see the UI ref below.

b) Test for remote


3: Problems
For any problems you can refers to [2] FAQ. Actually most of the problems can find the workaround there.

References:
[1] http://java.sun.com/performance/jvmstat
[2] http://java.sun.com/performance/jvmstat/faq.html
[3] https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=JVMSTAT-1.0-G-F@CDS-CDS_Developer
[4] https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=JVMSTAT-2.0-G-F@CDS-CDS_Developer
[5] http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf

VisualGC PID output:
A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)_第1张图片

jstat -gcutil 5964 1000 10 output:
A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)_第2张图片
  • A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)_第3张图片
  • 大小: 44.6 KB
  • A simple usecase(Java2DDemo) of jvmstat3.0(jps/jstat/visualgc)_第4张图片
  • 大小: 10.2 KB
  • 查看图片附件

你可能感兴趣的:(UseCase,J2SE,Java,SUN,C#)