Explanation of the content of Vmstat results
Vmstat
procs-----------Memory-------------Swap-------io------System-------CPU------
R b swpd free buff cache si so bi bo in CS us sy ID WA St
2 0 88 199564 134860 1175252 0 0 0 352 9323 10496 8 6 85 0 0
Procs
The R column represents the number of processes running and waiting for the CPU time slice, if the long-term is greater than 1, indicating that the CPU is low.
Column B indicates the number of processes waiting on the resource, such as waiting for I/O, or memory swapping.
Memory
SWPD The amount of memory to switch to the memory Swap area (k). If the value of SWPD is not 0, or larger, for example, more than 100m, as long as SI, so the value of long-term 0, system performance or normal
The amount of memory in the free current list of available pages (k)
Buff as the amount of memory in buffer cache, generally read and write to the block device requires buffering.
Cache: As the number of memory page cache, generally as the file system cache, if the cache is large, indicating that the file with the cache is more, if at this time bi is relatively small in Io, the file system efficiency is better.
Swap
Si the number of memory-swap areas entered by the RAM.
So the memory swap area enters the amount of memory.
Io
The total amount of data that bi reads from the block device (read disk) (KB per second).
The total amount of data written by the BO block device (write disk) (KB per second)
Here we set the Bi+bo reference value of 1000, if more than 1000, and the large WA value should consider balancing the disk load, can be combined with the Iostat output to analyze.
System shows the number of interrupts that occurred during the acquisition interval
The in column represents the number of device interrupts per second observed in a time interval.
The CS column represents the number of context switches produced per second, such as when CS is much higher than disk I/O and network packet rates, and should be investigated further.
CPU indicates usage status of CPU
The US column shows the percentage of CPU time that is spent in user mode. When the value of us is higher, the user process consumes more CPU time, but if the long-term is greater than 50%, you need to consider optimizing the user's program.
The SY column shows the percentage of CPU time that the kernel process spends. Here US + SY reference value is 80%, if us+sy greater than 80% indicates that there may be insufficient CPU.
The WA column shows the percentage of CPU time consumed by IO waits. Here WA has a reference value of 30%, if WA is more than 30%, it indicates that the IO wait is serious, this may be caused by a lot of random access to disk, or the bandwidth bottleneck of disk or disk access controller (mainly block operation).
The ID column shows the percentage of time that the CPU is in idle state
The output of the Vmstat command is divided into six parts:
(1) Process procs:
R: The number of processes waiting in the run queue.
B: The number of processes waiting for IO.
(2) Memory Memoy:
SWPD: Current swap memory available (in kilobytes).
Free: Idle memory (in kilobytes).
Buff: The amount of memory to buffer (in kilobytes).
Cache: The amount of memory that is used as a cache (in kilobytes).
(3) Swap swap page
Si: The number of swap pages, in kb/seconds, from disk swap to memory.
So: the number of swap pages from memory swap to disk, in kb/seconds.
(4) IO block device:
BI: The number of blocks sent to the block device, in blocks per second.
Bo: The number of blocks received from the block device, in blocks per second.
(5) System:
In: Number of interrupts per second, including clock interrupts.
CS: The number of environment (context) switches per second.
(6) CPU central Processor:
CS: The time that the user process used. expressed as a percentage.
SY: The time that the system process was used. expressed as a percentage.
ID: The idle time of the central processing Unit. expressed as a percentage.
If R is often greater than 4 and the ID is often less than 40, it means that the CPU is heavily loaded.
If the Bi,bo is not equal to 0 for a long time, it indicates that the physical memory capacity is too small.
Check the performance of the system.
1) CPU Usage analysis
The following metrics measure the load situation of the CPU.
Overall utilization:
[[Email protected] Stone]sar-u 5 5
Linux 2.4.21-4.ELSMP (LINUX1)
01/04/05
18:00:17 CPU%user%nice%system%idle
18:00:22 All 1.50 0.00 0.93 97.57
18:00:27 All 16.02 0.00 4.74 79.24
18:00:32 All 5.69 0.00 3.77 90.53
18:00:37 All 0.79 0.00 1.10 98.11
18:00:42 All 2.69 0.00 1.21 96.10
Average:all 5.15 0.00 2.24 92.61
Get the usage of the specified CPU number (in multi-CPU case)
[[email protected] Stone]sar-u 0
Linux 2.4.21-4.ELSMP (linux1) 01/04/05
00:00:00 CPU%user%nice%system%idle
00:10:00 0 1.10 0.00 0.83 98.36
00:20:00 0 0.55 0.00 0.78 97.52
00:30:00 0 0.97 0.00 0.77 98.57
00:40:00 0 1.15 0.00 0.93 97.09
00:50:00 0 1.88 0.00 1.33 95.96
01:00:00 0 1.20 0.00 1.11 96.66
01:10:00 0 0.78 0.00 1.26 97.96
01:20:00 0 1.07 0.00 1.04 96.91
01:30:00 0 1.24 0.00 1.01 97.29
You can get the running user process%user, the kernel process%system and the idle state as a percentage of CPU time.
Observe the data and get the conclusion:
Larger%user generally indicates that the server is in a running state; the larger the%system indicates that the server is in a system call
Or I/O operations. If the CPU is idle for a large amount of time (%idle), it means that the CPU is sufficient.
We can also get the number of times the kernel switches the current process on each time period, if the number is high, indicating that the server
There is a problem with the hardware.
[Email protected] Stone]sar-w
07:50:00 cswch/s
08:00:00 285.49
08:10:00 259.64
08:20:00 387.54
08:30:00 359.15
08:40:00 504.29
08:50:00 762.73
09:00:00 572.93
09:10:01 885.75
09:20:00 1159.97
09:30:00 1101.83
09:40:00 1095.72
09:50:00 1052.89
10:00:00 961.75
10:10:00 861.31
10:20:00 501.76
10:30:00 370.81
10:40:00 736.26
10:50:00 635.93
11:00:00 399.51
11:10:00 873.58
11:20:00 741.14
11:30:00 776.49
11:40:00 641.55
average:416.97
Average load:
The average system load is defined as the average number of processes running in a queue during a specific time interval, typically as long as each CPU
Before the number of active processes is not greater than 3 then the performance of the system is good, if the number of tasks per CPU is greater than 5, then it means that
The performance of the machine is seriously problematic.
[Email protected] Stone]uptime
18:07:22 up 10days, 8:05, 1user, load average:0.49, 0.31,1.18
Represents the average number of processes running in the queue in the past 1, 5, 15 minutes.
[Email protected] Stone]sar-q
07:50:00 Runq-sz Plist-sz ldavg-1 ldavg-5
08:00:00 0 214 0.01 0.08
08:10:00 0 222 0.37 0.21
08:20:00 1 229 0.41 0.42
08:30:00 0 239 0.45 1.10
08:40:00 0 242 0.24 0.36
08:50:00 1 253 1.55 1.98
09:00:00 0 248 0.45 0.55
09:10:01 0 273 8.17 3.85
09:20:00 0 295 0.62 0.99
09:30:00 0 279 0.87 0.79
09:40:00 1 284 0.62 0.68
09:50:00 0 302 0.38 0.51
10:00:00 0 277 0.98 0.79
10:10:00 2 289 0.60 0.55
10:20:00 2 264 0.28 0.33
10:30:00 0 269 0.28 0.31
10:40:00 0 284 0.58 0.46
10:50:00 0 324 1.18 0.62
11:00:00 0 311 0.43 0.31
11:10:00 0 330 0.65 0.54
11:20:00 1 335 0.45 0.45
11:30:00 1 345 0.39 0.47
11:40:00 0 322 0.22 0.36
average:0 296 0.65 0.60
Runq-sz: Number of processes waiting to run
Plist-sz: Total number of processes (in process list).
Ldavg-1: Average load for the last minute of the system
LDAVG-5: Average load for the last 5 minutes of the system
CPU consumption per process: By understanding the CPU consumption statistics of a particular process, we can determine whether a process has problems,
and improve it (to improve the process?) Improve hardware? ....)
You can use Ps-aux or top to observe the CPU consumption of a process.
In addition, the Vmstat tool can also report some CPU conditions.
[Email protected] Stone]vmstat
Procs Memory Swap IO system CPU
R b swpd free buff cache si so bi bo in cs us sy Idwa
0092456141164 102032 23465240 075 951168LENOVOSNB (2006-8-2318:23:39) 2) memory condition
You must understand the system memory management process, especially the principle of the exchange of pages. General use of the total amount of active virtual memory and the rate of page change to measure
The use of memory. From the total amount of active virtual memory we can obtain the memory demand, depending on the page rate we can get how much memory is in
In use. The higher the paging rate, the larger the memory usage (the disk will giggle), the more memory should be added.
Total Active virtual memory (VM) = actual memory size (size ofreal memories) + Swap space size used (amount of swap spaces used)
[Email protected] Stone]sar-r
07:50:00 kbmemfreekbmemused%memused kbmemshrdkbbuffers kbcached kbswpfreekbswpused%swpused
08:00:00 74532 3536724 97.94 0 90808 2237872 8294676 91172 1.09
08:10:00 93652 3517604 97.41 0 88864 2218328 8294696 91152 1.09
08:20:00 63192 3548064 98.25 0 69988 2269068 8294700 91148 1.09
08:30:00 272344 3338912 92.46 0 22552 2119284 8290536 95312 1.14
08:40:00 126104 3485152 96.51 0 38888 2242808 8290560 95288 1.14
08:50:00 191476 3419780 94.70 0 18528 2246968 8289944 95904 1.14
09:00:00 55304 3555952 98.47 0 32836 2368824 8285288 100560 1.20
09:10:01 201592 3409664 94.42 0 50876 2251528 8285708 100140 1.19
09:20:00 32912 3578344 99.09 0 66316 2410260 8285984 99864 1.19
09:30:00 55232 3556024 98.47 0 45944 2400496 8286072 99776 1.19
09:40:00 51652 3559604 98.57 0 64392 2383592 8286216 99632 1.19
09:50:00 45172 3566084 98.75 0 70144 2388804 8286428 99420 1.19
10:00:00 52068 3559188 98.56 0 64676 2395512 8286564 99284 1.18
10:10:00 51400 3559856 98.58 0 49620 2407528 8286596 99252 1.18
10:20:00 41692 3569564 98.85 0 47684 2424280 8286652 99196 1.18
10:30:00 35200 3576056 99.03 0 50336 2431268 8286656 99192 1.18
10:40:00 21400 3589856 99.41 0 64612 2423780 8286728 99120 1.18
10:50:00 83048 3528208 97.70 0 68084 2331448 8286796 99052 1.18
11:00:00 22072 3589184 99.39 0 70764 2416216 8286816 99032 1.18
11:10:00 34376 3576880 99.05 0 56780 2405008 8286824 99024 1.18
11:20:00 36376 3574880 98.99 0 48756 2397968 8286836 99012 1.18
11:30:00 43808 3567448 98.79 0 49708 2398852 8286924 98924 1.18
11:40:00 34884 3576372 99.03 0 60960 2408756 8286936 98912 1.18
11:50:00 38328 3572928 98.94 0 67080 2407960 8286936 98912 1.18
12:00:00 38932 3572324 98.92 0 72724 2406132 8286940 98908 1.18
12:10:00 109300 3501956 96.97 0 75348 2326492 8286940 98908 1.18
average:64548 3546708 98.21 0 96633 2330707 8291911 93937 1.12
[Email protected] Stone]swapon-s
Filename Type Size used priority
/DEV/SDB8 Partition 419292498908-1
/DEV/SDB10 Partition 4192924 0-2
With the above data, we can obtain
Total Active virtual memory (VM) =kbmem +kbswpused=3.54g
3.47G is the total amount of memory required by the current server.
[Email protected] Stone]sar-b
07:50:00 pgpgin/spgpgout/s activepg inadtypg INACLNPG INATARPG
08:00:00 9.34 139.23 566687 0 13589 142713
08:10:00 25.71 108.40 564261 0 13539 141743
08:20:00 149.36 191.93 573187 0 13399 143335
08:30:00 43.63 234.46 529094 35493 11998 134494
08:40:00 246.68 277.54 565985 25012 9177 141597
08:50:00 381.88 536.92 553537 52107 12381 140623
09:00:00 190.29 307.08 581102 31530 12311 147195
09:10:01 259.69 860.26 560927 60833 13643 142327
09:20:00 487.91 550.73 604302 55059 14379 151157
09:30:00 382.74 710.78 598312 70977 14059 149736
09:40:00 354.97 510.46 598398 70661 13795 149920
09:50:00 280.48 629.94 602880 64397 13864 150517
10:00:00 447.48 659.52 602483 69873 13362 150261
10:10:00 404.97 458.69 603719 68104 13724 150115
10:20:00 310.69 272.95 601711 67460 13898 150651
10:30:00 121.59 184.03 603972 56077 13928 151109
10:40:00 263.55 392.60 605818 60314 17208 151754
10:50:00 210.45 348.91 589640 72762 13761 148093
11:00:00 190.55 199.58 607545 54517 15086 151774
11:10:00 350.40 462.20 603874 75205 14074 150970
11:20:00 374.10 437.94 603769 70937 13904 150877
11:30:00 163.58 381.97 601763 62157 14369 150481
11:40:00 96.75 298.26 605429 45214 14093 151042
11:50:00 127.14 159.75 602817 38423 13911 150789
12:00:00 57.85 186.46 602126 27663 14362 150737
12:10:00 51.41 216.03 585281 32559 13808 146942
12:20:00 95.07 225.01 600874 6573 13793 150148
12:30:00 197.36 162.14 605716 5821 16786 151620
12:40:00 16.31 145.40 604436 0 14285 151002
average:100.76 226.88 591604 16947 13867 148584
PGPGIN/S: Number of kilobytes in page Exchange
PGPGOUT/S: Number of KB to swap out pages
ACTIVEPG: Number of active pages in memory
Inadtypg:number of Inactive dirty (modified or potentiallymodified) pages in memory.
Inaclnpg:number of Inactive clean (not modified) pages inmemory.
INATARPG: "Inactive target" number of pages. Thisfield is a 1-minute floating average of the number of
Pages Thesystem needs to "steal" every second on order to satisfy Memorydemand.
If the system always has a large number of kilobytes of swapped-out pages, the system requires memory. Of course, the INATARPG parameter can also explain the problem.
3) disk I/O
We can use Iostat to get the data of the system disk.
[email protected] stone] $iostat
Linux 2.4.20-19.7 (Localhost.localdomain) 01/06/2005
AVG-CPU:%user%nice%sys%idle
0.09 0.00 0.21 99.70
Device:tps blk_read/s blk_wrtn/s Blk_read Blk_wrtn
Dev3-1 0.77 4.65 17.03 11788068 43140248
Tps:indicate the number oftransfers per second that were issued to the device
Blk_read/s:indicate The amount of dataread from the drive expressed in a number of blocks Persecond
Blk_wrtn/s:indicate The amount of data written to the driveexpressed in a number ofblocks per second.
Blk_read:the total number of blocks read.
Blk_wrtn:the total number of blocks written.
[Email protected] stone]$ iostat-x
Linux 2.4.20-19.7 (Localhost.localdomain) 01/06/2005
AVG-CPU:%user%nice%sys%idle
0.09 0.00 0.21 99.70
device:rrqm/swrqm/s r/s w/s rsec/s wsec/savgrq-sz avgqu-sz await SVCTM%util
HDB 0.46 1.48 0.12 0.65 4.65 17.04 28.13 0.10 118.90207.70 1.60
HDB1 0.00 0.00 0.00 0.00 0.00 0.00 9.52 0.00 128.76 88.84 0.00
HDB2 0.46 1.48 0.12 0.65 4.65 17.01 28.17 0.09 117.58 13.39 0.10
HDB3 0.00 0.00 0.00 0.00 0.00 0.03 15.25 0.00 619.92519.40 0.01
[Email protected] stone]$ ProcInfo
Linux 2.4.20-19.7 ([email protected]) (gcc 2.9620000731) #1 Tue Jul 13:45:48 EDT 2003 1CPU [localhost]
Memory:total used free Shared buffers Cached
mem:255896 247240 8656 0 78772 87056
swap:522104 26036 496068
bootup:wed Dec 8 10:28:532004 Load average:0.00 0.000.00 1/72 2571
user:0:37:18.15 0.1% page in:5894299 disk1:306840r 1648467w
nice:0:00:20.57 0.0% Page out:21578634
system:1:27:38.76 0.2% Swap in:985
idle:29d 5:39:38.40 99.7% swapout:8822
uptime:29d 7:44:55.87 context:320846503
IRQ 0:253349588timer IRQ 6:6
IRQ 1:3keyboard IRQ 8:1RTC
IRQ 2:0 Cascade[4] irq12:5277552 usb-uhci,eth0
IRQ 3:3 IRQ14:1953315IDE0
IRQ 4:3
4) Network Load
You can view network interface data status first
Ifconfig if collisions:0 data is found to be large (accounting for more than 5% of the data sent or received), the network
Severe blockage.
Netstat-i
Kernel Interface Table
Iface MTU Met rx-ok rx-err rx-drp rx-ovr tx-ok tx-err tx-drp TX-OVR FLG
Eth0 0 4701184 0 0 0 912247 0 0 0 Bmru
Lo 16436 0 1285408 0 0 01285408 0 0 0 LRU
Linux Server Performance Status View