w、vmstat、top、sar、nload

10.1 Use w to view system load

  1. w/uptime view system load
    1. The first line: the current time, you can use date to view the system time, system startup time, currently logged in users, system load, one minute, five minutes, how many processes are using cpu activity in a unit time period within fifteen minutes (is one Average value) The value is related to the number of CPUs. The CPU here is a logical CPU, not a physical CPU. You can # cat /peoc/cpuinfocheck the number of logical CPUs. The key field is processor. This number plus 1 is the number of logical CPUs. A physical CPU can have multiple cores, and each core can have multiple logical CPUs. w Check that the load average value is the most reasonable value of the logical cpu. The first value that is more concerned is the current system load value.
    2. The second line: user, login terminal, ip
  2. cat/proc/cpuinfo to view the number of cpu cores
  3. usage vmstat 1
  4. Related lines: r, b, swpd, si, so, bi, bo, us, wa
  5. top to view the resource usage of the process
  6. top -c view

10.2 The vmstat command

  1. If the cpu load value is high, use vmstat to view the cpu memory, virtual disk, swap partition,
  2. vmstat 1 1 second for the period, always showing the status
  3. vmstat 1 5 displays a total of 5 columns
  4. r: run indicates how many processes are in the run state
  5. b: block indicates that the process is blocked by conditions other than cpu, such as network speed, disk
  6. swpd: swap partition, when the memory is not enough, the data will be placed in the sweep partition, when there is a value, it means that the memory is not enough to use
  7. si: how many Kb data from sweep into memory
  8. so: How many Kb data are entered into sweep from memory
  9. bi: the amount of data coming out of disk and into memory
  10. bo: the amount of data written to disk
  11. us: User level, how much the user occupies, the number will not exceed 100, the value is a percentage, such as some services, if it is greater than 50 for a long time, it means that the CPU is tight
  12. sy: the percentage of CPU occupied by the system itself
  13. id: percentage of idle cpu
  14. us+sy+id = 100
  15. wa: wait waiting, similar to b, waiting for the cpu process
  16. Through this command, you can view the bottleneck of the system, cpu, disk

10.3 top command

  1. Top can view the specific process, dynamic display in 3 seconds
  2. The first line: same as w command
  3. The second line: statistics of the number of process information, the zombie process means that the main process ended unexpectedly, and the child process is not closed
  4. The third line: cpu information statistics, unit percentage, st means stolen cpu, such as when there is a virtual machine
  5. Fourth line: memory usage
  6. Fifth line: swap partition usage
  7. The sixth line: the default cpu usage is sorted from high to low; RES physical memory size unit Kb; uppercase M can be sorted by memory; P can be sorted by cpu; number 1, you can view a single cpu usage
  8. PID needs attention, kill PID can kill the process
  9. Press the letter q to exit the top command
  10. top -c can view the global path of the specific process command
  11. top -bn1 lists all processes at one time, suitable for use when writing scripts.

10.4 The sar command

  1. Without this package you need to install yum install -y sysstat
  2. Running sar directly calls a history file in the system by default. /var/log/sa is the path of this history file, which is generated every minute that is an integer multiple of 10. sa17 is a binary file, and sar17 can be opened.
  3. sar -n DEV NIC traffic
    1. sar -n DEV 1 10 is displayed every 1 minute, a total of 10 times
    2. The data packets accepted by rxpck/s, a few thousand is a normal value, if it is tens of thousands, it is an abnormal value
    3. Packets sent by txpck/s
    4. The amount of data accepted by rxkB/s
    5. The amount of data sent by txkB/s
  4. sar -q system load
  5. sar -b disk read and write
  6. sar -n DEV -f /var/log/sa/sa17 ends with a date, the contents of this directory are retained for a maximum of one month

10.5 nload command

  1. yum install epel-release
  2. yum install -y nload
  3. nload
  4. The first line is the name of the network card, ip, and the arrow keys switch the network card

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325620979&siteId=291194637