uptime
1 | huting3@ai23:~$ uptime |
查看系统负载最方便的方式,但是要结合其他工具理解。
dmesg | tail
1 | $ dmesg | tail |
查看系统消息
vmstat 1
1 | $ vmstat 1 |
检查所有cpu的平均使用情况。
Columns to check:
r: Number of processes running on CPU and waiting for a turn. This provides a better signal than load averages for determining CPU saturation, as it does not include I/O. To interpret: an “r” value greater than the CPU count is saturation.
free: Free memory in kilobytes. If there are too many digits to count, you have enough free memory. The “free -m” command, included as command 7, better explains the state of free memory.
si, so: Swap-ins and swap-outs. If these are non-zero, you’re out of memory.
us, sy, id, wa, st: These are breakdowns of CPU time, on average across all CPUs. They are user time, system time (kernel), idle, wait I/O, and stolen time (by other guests, or with Xen, the guest’s own isolated driver domain).
mpstat -P ALL
1 | $ mpstat -P ALL 1 |
查看每个cpu的使用情况,用来检查不均衡的状况。
pidstat 1
1 | $ pidstat 1 |
查看进程的内存使用情况
iostat -xz 1
1 | $ iostat -xz 1 |
查看硬盘的使用情况。
r/s, w/s, rkB/s, wkB/s: These are the delivered reads, writes, read Kbytes, and write Kbytes per second to the device. Use these for workload characterization. A performance problem may simply be due to an excessive load applied.
await: The average time for the I/O in milliseconds. This is the time that the application suffers, as it includes both time queued and time being serviced. Larger than expected average times can be an indicator of device saturation, or device problems.
avgqu-sz: The average number of requests issued to the device. Values greater than 1 can be evidence of saturation (although devices can typically operate on requests in parallel, especially virtual devices which front multiple back-end disks.)
%util: Device utilization. This is really a busy percent, showing the time each second that the device was doing work. Values greater than 60% typically lead to poor performance (which should be seen in await), although it depends on the device. Values close to 100% usually indicate saturation.
free -m
1 | $ free -m |
sar -n DEV 1
1 | $ sar -n DEV 1 |
查看网络吞吐量。
sar -n TCP,ETCP 1
1 | $ sar -n TCP,ETCP 1 |
查看网络连接情况
top
1 | $ top |
查看系统性能。