1. top
View the system load, load average
CPU usage, view the usage of each CPU by 1
Shift + h view the status of each thread
2. free-m
Memory usage, unused usage, and total output in megabytes
Total used free shared buffers cached
Mem: 32176 27911 4265 0 132 7114
-/+ Buffers/cache: 20664 11512
Swap: 31996 0 31996
3. View server disk usage
Df-h
File System capacity used available % mount point
/Dev/sda3 510 GB 317G 168G 66%/
/Dev/sda1 996 M 40 M 905 M 5%/boot
Tmpfs 16G 0 16G 0%/dev/shm
Check which directory the disk is using too large
Du-h -- max-depth = 1/etc/
4. View java Processes
Ps-ef | grep java
5. view the threads with the largest CPU usage
Ps Hh-eo pid, tid, pcpu | sort-nk3 | tail
2858 2889 1.0
2858 3982 1.8
6796 7480 2.2
View the stack of the corresponding thread
Jstack 6796 | grep-C 10 'nid = 0x1d38'
Note 7480 ---> hexadecimal 1D38 ---> lower case
6. view memory objects
Jmap-histo: live pid | head-n 20
It is best not to add live, which will cause FGC
7. Check gc:
Jstat-gcutil <pid> <frequency> times
-Rbash-3.2 $ jstat-gcutil 6796 1000 3
S0 S1 E O P YGC YGCT FGC FGCT GCT
0.00 26.80 19.02 76.18 21.64 1607 90.868 4 15.923 106.791
0.00 26.80 23.08 76.18 21.64 1607 90.868 4 15.923 106.791
0.00 26.80 26.21 76.18 21.64 1607 90.868 4 15.923 106.791
8. Generate a memory stack File
Jmap-dump: format = B, file =/soft/dump/mem_dump.bin pid
Tar-czf mem_dump.tar.gz mem_dump.bin
Analysis by using the MemoryAnalyzer tool of Eclipse
JVM related: http://www.cnblogs.com/redcreen/tag/jvm/