赞
踩
问题说明
为了分析和定位一个Java线上系统问题,我们需要查看JVM启动时的一些参数设置,例如:垃圾回收算法、堆大小等等。这些参数可能在启动脚本中明确指明,也可能采用默认值。在系统运行过程中其他人也许动态调整了系统参数。
问题解决
通过jps命令找对对应的进程号
[root@swk-207 ~]# jps -lm |grep xk
17743 /xxx/server/skynet/lib/skynet-cloud-xloader-2.1.0.1007.jar --skynet.action.jagent.file=/xxx/server/skynet/lib/jagent --skynet.action.boot.file=xk-process-1.1.1-SNAPSHOT-with-dependencies.jar --server.port=34969
[root@swk-207 ~]#
通过PS命令获取
[root@swk-207 ~]# ps eww 7364
PID TTY STAT TIME COMMAND
7364 ? Sl 112:12 java -Dloader.path=/xxx/server/skynet/plugin/xk-proc/plugins -Djava.tmp.dir=/xxx/server/skynet/plugin/xk-proc/tmp -Djava.io.tmpdir=/xxx/server/skynet/plugin/xk-proc/tmp -Dfile.encoding=UTF-8 -Dxxx.dir.log=/xxx/server/skynet/plugin/xk-proc/logs -Dskynet.jagent.config.location.uri=http://10.5.3.207:6230/skynet/config/xk-proc@xk-proc?actionId=xk-proc@xk-proc -jar /xxx/server/skynet/lib/skynet-cloud-xloader-2.1.0.1007.jar --skynet.action.jagent.file=/xxx/server/skynet/lib/jagent --skynet.action.boot.file=xk-process-1.1.1-SNAPSHOT-with-dependencies.jar --server.port=45471 PATH=/usr/java/jdk1.8.0_112/bin:/usr/java/jdk1.8.0_112/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin HISTCONTROL=ignoredups HISTSIZE=1000 JAVA_HOME=/usr/java/jdk1.8.0_112 XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt LANG=en_US.UTF-8 XDG_SESSION_ID=2878 SELINUX_LEVEL_REQUESTED= JRE_HOME=/usr/java/jdk1.8.0_112/jre SELINUX_ROLE_REQUESTED= MAIL=/var/spool/mail/root LOGNAME=root PWD=/xxx/server/skynet/bin _=/usr/bin/nohup SHELL=/bin/bash LESSOPEN=||/usr/bin/lesspipe.sh %s SELINUX_USE_CURRENT_RANGE= SSH_CLIENT=10.5.3.207 33002 22 USER=root CLASSPATH=.:/usr/java/jdk1.8.0_112/lib/dt.jar:/usr/java/jdk1.8.0_112/lib/tools.jar SSH_CONNECTION=10.5.3.207 33002 10.5.3.207 22 HOSTNAME=swk-207 NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat XDG_RUNTIME_DIR=/run/user/0 HOME=/root SHLVL=2
[root@swk-207 ~]#
通过JCMD命令获取
[root@swk-207 ~]# jcmd 7364 VM.flags
7364:
-XX:CICompilerCount=12 -XX:InitialHeapSize=1054867456 -XX:MaxHeapSize=16846422016 -XX:MaxNewSize=5615124480 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=351272960 -XX:OldSize=703594496 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC
通过JPS命令获取
[root@swk-207 ~]# jps -lmvV |grep 7364
7364 /xxx/server/skynet/lib/skynet-cloud-xloader-2.1.0.1007.jar --skynet.action.jagent.file=/xxx/server/skynet/lib/jagent --skynet.action.boot.file=xk-process-1.1.1-SNAPSHOT-with-dependencies.jar --server.port=45471 -Dloader.path=/xxx/server/skynet/plugin/xk-proc/plugins -Djava.tmp.dir=/xxx/server/skynet/plugin/xk-proc/tmp -Djava.io.tmpdir=/xxx/server/skynet/plugin/xk-proc/tmp -Dfile.encoding=UTF-8 -Dxxx.dir.log=/xxx/server/skynet/plugin/xk-proc/logs -Dskynet.jagent.config.location.uri=http://10.5.3.207:6230/skynet/config/xk-proc@xk-proc?actionId=xk-proc@xk-proc
通过JINFO命令获取
[root@swk-207 ~]# jinfo -flags 7364
Attaching to process ID 7364, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.112-b15
Non-default VM flags: -XX:CICompilerCount=12 -XX:InitialHeapSize=1054867456 -XX:MaxHeapSize=16846422016 -XX:MaxNewSize=5615124480 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=351272960 -XX:OldSize=703594496 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseParallelGC
Command line: -Dloader.path=/xxx/server/skynet/plugin/xk-proc/plugins -Djava.tmp.dir=/xxx/server/skynet/plugin/xk-proc/tmp -Djava.io.tmpdir=/xxx/server/skynet/plugin/xk-proc/tmp -Dfile.encoding=UTF-8 -Dxxx.dir.log=/xxx/server/skynet/plugin/xk-proc/logs -Dskynet.jagent.config.location.uri=http://10.5.3.207:6230/skynet/config/xk-proc@xk-proc?actionId=xk-proc@xk-proc
通过JMAP命令获取
[root@swk-207 ~]# jmap -heap 7364
Attaching to process ID 7364, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.112-b15
using thread-local object allocation.
Parallel GC with 18 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 16846422016 (16066.0MB)
NewSize = 351272960 (335.0MB)
MaxNewSize = 5615124480 (5355.0MB)
OldSize = 703594496 (671.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 89128960 (85.0MB)
used = 76264488 (72.73148345947266MB)
free = 12864472 (12.268516540527344MB)
85.56645112879136% used
From Space:
capacity = 524288 (0.5MB)
used = 294912 (0.28125MB)
free = 229376 (0.21875MB)
56.25% used
To Space:
capacity = 524288 (0.5MB)
used = 0 (0.0MB)
free = 524288 (0.5MB)
0.0% used
PS Old Generation
capacity = 718274560 (685.0MB)
used = 41295448 (39.382408142089844MB)
free = 676979112 (645.6175918579102MB)
5.74925666307881% used
29846 interned Strings occupying 3647224 bytes.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。