@[toc]


1. The whole machine

top

1

uptime

System performance commands compact version uptime

'Load Average' : indicates the system load balancing. The three values represent the system load average of 1 minute, 5 minutes, and 15 minutes, divide by 3, and multiply by 100%. If the value is higher than 60%, it indicates that the system is under heavy loadCopy the code

2. CPU

vmstat

vmstat -n 2 3

vmstat

  • procs

    • R: indicates the number of processes running and waiting for the CPU time chip. In principle, the number of running queues for a CPU with one core should not exceed two, and the number of running queues in the whole system should not exceed two times of the total number of cores. Otherwise, the system is under high pressure
    • B: Number of processes waiting for resources, such as disk I/O and network I/O
  • cpu

    • Us: indicates the percentage of CPU time slices consumed by user processes. If the us value is high, the CPU time consumed by user processes is high. If the US value is higher than 50% for a long time, the program needs to be optimized
    • Sy: percentage of CPU time consumed by the kernel process

    The us + SY reference value is 80%. If the US + SY value is greater than 80%, the CPU may be insufficient

    • Id: percentage of cpus in space
    • Wa: percentage of CPU time that the system waits for I/OS
    • St: Percentage of stolen CPU time from a vm

See additional

  • View information about all CPU coresmpstat -P ALL 2Samples are taken every 2 secondsmpstat -P ALL 2 5Sampling is performed every 2 seconds for 5 times in total
  • The CPU usage of each process is broken downPidstat -u 1 -p Indicates the process number

3. The memory

Number of memory available to the application free

Free-g Memory size Statistics based on GB Free-m Memory size statistics based on MB

  • Available memory of an experienced application/System physical memory > 70% Sufficient memory < 20% Insufficient memory. You need to increase the memory by 20% to 70%

See additional

Pidstat -p Process ID -r Sampling interval secondsCopy the code

4. The hard disk

df

Df -h Displays the remaining disk space

5. Disk IO

iostat

iostat -xdk 2 3

  • RkB /s Data read per second kB

  • WkB /s Data written per second kB

  • SVCTM Average SERVICE time of I/O requests, in milliseconds

  • Util a few hundredths of a second is used for I/O operations, indicating that disk bandwidth is full and needs to be optimized or added to the disk

    RkB /s and wkB/s have different values according to different system applications, but there are rules to follow: The value of the SVCTM is very close to the await value, indicating that there is almost no I/O waiting. The disk performance is good. If the await value is much higher than the SVCTM value, it indicates that the I/O queue is too long and the disk needs to be optimized or replaced

See additional

Pidstat -d Number of sampling intervals -p Process NUMBER

6. Network IO

ifstat

Wget http://distfiles.macports.org/ifstat/ifstat-1.1.tar.gz tar XZVF ifstat 1.1. Tar. Gz CD ifstat - 1.1. / configure the make make installCopy the code

Check the command

ifstat 1
Copy the code

In and out of each network adapter Observe network load. Check whether network read and write is normal

  • Program network I/O optimization
  • Increase network I/O bandwidth

Mr.superbeyone