java interview -linux command

 First, the production server slows down, thinking about your diagnosis.

Machine: top [ See CPU, memory Average Load (. 1 minute, 5 minutes, 15 minutes system load average value of three values are added / 3 * 100%> 60% system load pressure] 
Uptime: System Performance command Lite
See CPU: the vmstat -n 2. 3
[R & lt procs: run and wait CPU time slice process b can not exceed two times the total number of nuclei: the number of processes waiting for a resource]
[US CPU: percentage of CPU time consumed by user process SY: core process consumes CPU time percentage of us + sy> 80% there is insufficient CPU]

mpstat -P ALL 2: View all idle CPU core information [on behalf of CPU idle value, the higher the better]
PS -ef | grep the Java
pidstat 1 -p -u No process: each process CPU usage decomposition of information
View Memory: as Free [as Free -m] 
[as Free / Total> 70% memory ample free / total <20% memory shortage]

pidstat -r -p process ID using the number of seconds

to view the disk: df -h [View the number of remaining disk space ]

disk IO: iostat 2 3 -xdk
have several percent in [IO operations for one second disk bandwidth approaching 100% run over, or the need to increase the disk optimizer]
       pidstat -p process ID number of seconds between using -d
Network IO: ifstat [default local no need to download]

Second, the production environment has high CPU, talk about your ideas and positioning analysis

 Idea: combine Linux and JDK command analyzed together

1, first find the highest proportion of the CPU with the top command 
2, ps -ef | grep java | grep -v | grep or jps -l further positioning 
3, targeted to specific threads or code 
ps -mp process number -o THREAD, tid, time [-m: show all threads -p pid: CPU time used by the process -o: user-defined format] 
4, the desired thread ID is converted to hexadecimal format 
5, jstack process ID

  

Guess you like

Origin www.cnblogs.com/wjh123/p/11080617.html