Linux common performance monitoring commands top, sar, iostat, pi
1. Common options for top:
-p continuously track the status of a process; commonly used operation instructions:
Numeric key 1: expand the status of all cpu
Shift+
< 或者 shift+>Toggle the sorted reference field to the left or right; special usage for continuous tracking:
Redirect the output to a file: top-n 1-b | head-30 > top.log2,sar (provided by the sysstat package, which may not come with the operating system) sar command can also monitor many performance indicators, I am used to monitoring network card traffic (- n): usage: sar-n EDEV 1 (sampling interval) 10 (sampling times)-n DEV: network interface statistics.
-n EDEV: network interface error.
-n IP: IP Datagram statistics.
-n EIP: IP error statistics.
-n TCP: TCP statistics.
-n ETCP: TCP error statistics.
-n SOCK: socket usage. In addition:-u option to monitor cpu,-r memory,-d disk io, etc. 3 common usage of iostat iostat: iostat-Iostat 1 (sampling interval) 10 (sampling times) output sample:
Device: rrqm/s wrqm/s rUnip s wdeband s rMB/s wMB/s avgrq-sz avgqu-sz await svctm% util
Sda 1.58 40.77 39.45 273.86 1.10 7.80 58.15 3.69 11.79 1.41 44.07 the last three indicators: io delay, io waiting time, io utilization% util is very large and 80% of the device is busy
The await is much larger than the svctm. The latency is very large.
The avgqu-sz queue is long.
R _ pact _ r _ r _ I _ o reads and writes frequently
Percentage of IO waiting time is large% iowait
Iowait%