JVM performance profiling (有待整理)

Agenda

memory model

3 parts:

* heap,

         heap: young and old generation

                    young: eden, fromspace(surviror1), tospace(surironr2)

* permanent generation space (use to store your classes and meta data) ,

 thread stack(pointer, local var)


== quoted ==

To get the clear memory diagram:http://blog.pointsoftware.ch/index.php/under-the-hood-runtime-data-areas-javas-memory-model/

http://www.yourkit.com/docs/kb/sizes.jsp

http://www.slideshare.net/gengmao/inside-the-jvm-memory-management-and-troubleshooting  

PermGen space

The method area is also known as the permanent generation space (PermGen). Allclass data are loaded into this memory space. This includes the field and method data and the code for the methods andconstructors

Heap memory

Since objects are stored in the heap part it is worth to have a closer look. The heapspace itself is again separated into several spaces:

-Young generation  with eden and survivor space

-Old Generation with tenured space

Each space harbors objects with different life cycles:

-New/short-term objects are instantiated in the eden space.

-Survived/mid-term objects are copied from the eden space to the survivor space.

- Tenured/long-term objects arecopied from the survivor to the old generation space.

== unquoted ==


jvm setting

GC algorithm: serial, ... etc, MaxNewSize,  MaxSize ,  there is recommendation online, client side, server side and diff platform.

JavaOne: best heap percent :43% ??


tunning concerns

availablility  , throughput, latency and responsiveness, memory footprint (100 txn need how many mem?), startup time


real time profiling

Remote
Add JMX parameter to bootstrap script


$JAVA_HOME/bin/java ${GC_OPTS} \
-Dcom.sun.management.jmxremote  \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-classpath $PROJ_CLASSPATH ${BOOTSTRAPPER} ${PARAMETER}

Local 

VisualVM/Jconsole is able to detect the running JAVA application process id..

http://www.gamlor.info/wordpress/2011/09/visualvm/

Eclipse for VisualVM (https://visualvm.java.net/eclipse-launcher.html)

JMX profile ?! - linux svr profile , like shell

server port number?!  - need ask server team

Will it cause the app slowness? - yes, occupy CPU


post gc analysis

Enable the verbose:gc option in the bootstrap script

-verbose:gc

-Xms512m -Xmx1024m

-XX:+PrintGCTimestamps

-XX:+PrintGCDetails

-Xloggc:./${GC_LOG}

After the log file generated, you can use the tool to analyse. - GC Histogram Tool

All GC

Young GC - GC in young generation ?

Full GC - 


Good tips:

Eclipse plugin center - for you to goto there via company proxy, 

1. check from stackoverflow site - Add parm into eclipse.ini  ;

2. disable socket proxy port


Websphere JVM profiling on app server

Ask WAS team to install a was plugin into for monitor


[root@OPS2-TEST ~]# ps -ef | grep java
root     10981     1  0 Nov20 ?        00:07:28 /usr/java/jdk1.6.0_31/bin/java -Djava.util.logging.config.file=/usr/tomcat/conf/logging.properties -Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxNewSize=128m -XX:MaxPermSize=256m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8081 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/tomcat/endorsed -classpath /usr/tomcat/bin/bootstrap.jar -Dcatalina.base=/usr/tomcat -Dcatalina.home=/usr/tomcat -Djava.io.tmpdir=/usr/tomcat/temp org.apache.catalina.startup.Bootstrap start

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值