如何在IBM JDK 1.5中查看WebSphere的内存使用情况,如何调出java dump,如何生成hprof?
在IBM JDK 1.5中,可以使用如下命令生成java dump和heap dump
# 查找 JVM objectName:
<wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<servername>,node=<nodename>,*]
或
<wsadmin> set objectName [$AdminControl completeObjectName type=JVM,process=<servername>,*]
# 对 JVM MBean 调用 dumpThreads 操作:
<wsadmin> $AdminControl invoke $objectName dumpThreads
# 查找 JVM objectName:
<wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<servername>,node=<nodename>,*]
# 对 JVM MBean 调用 generateHeapDump 操作:
<wsadmin> $AdminControl invoke $objectName generateHeapDump
由于在IBM JDK 1.4.2中,generateHeapDump不可用,可以使用如下命令生成java dump和heap dump
可以在"进程管理 -> 进程定义 -> 环境条目"中添加以下属性
IBM_HEAPDUMP true Enables heap dumps by means of signals
IBM_HEAPDUMPDIR <your_dump_dir> heapdump存放目录
IBM_HEAPDUMP_OUTOFMEMORY true 在outofmemory时生成heap dump
IBM_HEAP_DUMP true Enables heap dumps by means of signals
IBM_JAVADUMP_OUTOFMEMORY true 在outofmemory时生成java dump
IBM_JAVA_HEAPDUMP_TEXT true Enables heap dumps to be generated in .txt format not in .phd
生成java dump的方法如下:
# 查找 JVM objectName:
<wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<servername>,node=<nodename>,*]
# 对 JVM MBean 调用 dumpThreads 操作:
<wsadmin> $AdminControl invoke $objectName dumpThreads
生成heap dump的方法如下:
# 查找 JVM objectName:
<wsadmin> set objectName [$AdminControl queryNames WebSphere:type=JVM,process=<servername>,node=<nodename>,*]
按下Ctrl+Break