`
thihy
  • 浏览: 68213 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

JVM调优实战

 
阅读更多

JVM GC监控

JSTAT监控

SUN JVM自带了jstat工具,用于输出GC等信息。

 

命令格式

 

jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]

 

使用方法及输出

见 http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstat.html

JVisualVM监控

JSTATD方式

见 http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstatd.html

 

通过运行JStatd,可以在远程主机上打开端口,本地可以使用JVisualVM来连接。

 

需要注意,JStatd需要权限配置。比如,保存下面文本在all.policy

 

grant codebase "file:${java.home}/../lib/tools.jar" {
   permission java.security.AllPermission;
};

 

然后运行

jstatd -J-Djava.security.policy=all.policy

 

 

JMX方式

JMX默认是关闭的,可以通过传入系统属性来开启。

http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html

http://docs.oracle.com/javase/6/docs/technotes/guides/jmx/index.html

部分属性定义如下:

  1. java.rmi.server.hostname = 本机IP
  2. com.sun.management.jmxremote.port = JMX端口
  3. com.sun.management.jmxremote.ssl = true/false 是否使用SSL
  4. com.sun.management.jmxremote.authenticate = true/false 是否验证
    

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics