Box Original Source: github- source file notes , github- source code , welcomed the Star, reproduced, please attach the original source link and this statement.
Java JVM- Virtual Machine column series notes, systematic learning can access your personal recovery disk notes - technology blog Java JVM- Virtual Machine
Investigation process
- Perform
jps -l
PID command, positioning high memory footprint
jps -l
1174 org.elasticsearch.bootstrap.Elasticsearch
- Execute
jmap -histo:live PID
command to view the live objects
jmap -histo:live 1174
num #instances #bytes class name (module)
-------------------------------------------------------
1: 7570 503328 [B ([email protected])
2: 6987 167688 java.lang.String ([email protected])
3: 1224 150344 java.lang.Class ([email protected])
4: 3825 122400 java.util.HashMap$Node ([email protected])
... 更多内容未粘贴
- Implementation of
jmap -dump:live,format=b,file=test.dump PID
the surviving objects into off-line analysis for the dump file
Note that while a dump file is too large, in order to ensure that the information is reliable dump, it will suspend the application. For the analysis of the dump file is recommended jprofiler tool for analysis.
If jmap added: After the live parameters, JVM will first trigger gc, then statistics.
Spread
Memory area occupancy can be analyzed using the jstat
command analysis
For example: Perform jstat -gcutil -t -h 5 PID 500 10
see how each memory area occupancy
jstat -gcutil -t -h 5 1174 500 10
Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
1138.7 0.00 100.00 25.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1139.2 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1139.8 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1140.3 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1140.8 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
Timestamp S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
1141.3 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1141.8 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1142.3 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1142.8 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
1143.3 0.00 100.00 50.00 22.32 94.42 85.09 29 0.064 4 0.067 0.131
Explanation
More detailed usage JDK related commands can reference Java JVM JDK13 diagnostic command processing tool jps, jstat, jinfo, jmap, jstack, jcmd
High CPU utilization analysis in this column refer to the "Troubleshooting - high CPU usage"
The actual production process, we can use the dump file for analysis or use some visual troubleshooting tool