關於vmstat

AIX vmstat 詳解

vmstat Command

Purpose

       Reports virtual memory statistics.

Syntax

       vmstat [ -f ] [ -i ] [ -s  ] [ -I[-W]] [ -t ] [ -v ] [ -h ] [ -w ] [ -l ] [-c] [ -@ wparname |  ALL ] [ { -p | -P }
       pagesize | ALL ] ALL ] [ -S power]  [ physicalvolume ... ] [ interval [ count ] ]

       Note: Do not use the wparname parameter and the -i flag together inside workload partitions.

Description

       The vmstat command reports statistics about kernel threads, virtual memory, disks, hypervisor pages, traps and processor
       activity. Reports generated by the vmstat command can be used to balance system load activity. These system-wide statistics
       (among all processors) are calculated as averages for values expressed as percentages, and as sums otherwise. The vmstat
       command might return inconsistent statistics because the statistics are not read atomically.


       If you run the vmstat command without flags, the report contains a summary of the virtual memory activity since system
       startup. If you specify the -f flag, the vmstat command reports the number of forks since system startup. The
       physicalvolume parameter specifies the name of the physical volume.


Description
       lcpu
            Indicates the number of logical processors.
       mem
            Indicates the amount of memory.
       tmem
            Indicates the true memory size of  LPAR.
            Note: This is available only when -c option is provided and Active Memory Expansion is enabled.
       ent
            Displays only when the partition is running with shared processor.
       drives
            Displays only when physical volume name is monitored.
       WPARs
            Indicates the number of active workload partitions. It is displayed only when the -@ flag is specified.
       memlim
            Indicates the limit of the memory resource of the workload partition. The limit is in megabytes (MB). This information
            is displayed only for the WPAR that has enforced memory resource limit.
       cpulim
            Indicates the limit of processor resource of the workload partition in processor units. This information is displayed
            only for the WPAR that has enforced processor resource limit.
       rset
            Indicates the type of the rset registry that is associated with a WPAR. The type can be regular or exclusive. This
            information is displayed only for the WPARs that are associated with an rset registry.
       mmode
            Indicates memory mode. This metric is displayed automatically in a system with Active Memory Sharing enabled. This
            metric is also displayed when -c option is used.
       mpsz
            Size of the memory pool in gigabytes. This metric is displayed only in shared-memory mode.


       The column headings and their descriptions follow:


       WPAR: Information about workload partitions. It displays only when the -@ flag is specified.
       Item
            Description
       WPAR
            Workload partition name.
            
            
      re
            Pager input/output list.
       pi
            Pages paged in from paging space.
       po
            Pages paged out to paging space.
       fr
            Pages freed (page replacement).
       sr
            Pages scanned by page-replacement algorithm.
       cy
            Clock cycles by page-replacement algorithm.

       Faults: Trap and interrupt rate averages per second over the sampling interval.
       Item
            Description
       in
            Device interrupts.
       sy
            System calls.
       cs
            Kernel thread context switches.

       CPU: Breakdown of percentage usage of processor time.
       Item
            Description
       us
            User time.
       sy
            System time.
       id
            Processor idle time.
       wa
            Processor idle time during which the system had outstanding disk/NFS I/O request(s). See detailed description above.
       pc
            Number of physical processors consumed. Displayed only if the partition is running with shared processor.
       ec
            The percentage of entitled capacity consumed. Displayed only if the partition is running with shared processor.
            Because the time base over which this data is computed can vary, the entitled capacity percentage can sometimes exceed
            100%. This excess is noticeable only with small sampling intervals.
       rc
            The percentage of processor resource that is consumed. This information is displayed only for the WPARs that have
            enforced processor resource limit.            
       memory
            The columns csz, cfr, and dxm will be displayed besides columns avm and fre.
              csz
                   Current compressed pool size, in 4K page units.
              cfr
                   Free pages available in compressed pool, in 4K page units.
              dxm
                   Deficit in Expanded Memory Size, in 4K page units.
       page
            New columns ci and co will be displayed instead of re and cy columns.
              ci
                   Number of page-ins per second from compressed pool.
              co

                   Number of page-outs per second to compressed pool.

AIX實驗:

            
$ vmstat 
System Configuration: lcpu=16 mem=40960MB

kthr    memory              page              faults        cpu    
----- ----------- ------------------------ ------------ -----------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa
 1  1 5017638 11935   0   0   0   1    2   0  18 6611 764  1  0 99  0


$ vmstat -@ ALL
System configuration: lcpu=16 mem=40960MB drives=0 ent=4.00 wpar=0
wpar  kthr    memory              page              faults              cpu          
----- ----- ----------- ------------------------ ------------ -----------------------
       r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa    pc    rc

System  1  1 5012423 17122   0   0   0   1    2   0  18 6611 764  0  0 99  0  1.52  38.0            


$ vmstat 1 3
System Configuration: lcpu=16 mem=40960MB

kthr    memory              page              faults        cpu    
----- ----------- ------------------------ ------------ -----------
 r  b   avm   fre  re  pi  po  fr   sr  cy  in   sy  cs us sy id wa
 0  0 5744174 35364   0   0   0   0    0   0   7  517 639  0  0 99  0


 0  0 5744044 35494   0   0   0   0    0   0  25 4609 673  1  0 99  0
 1  0 5744044 35487   0   0   0   0    0   0  10 1441 635  0  0 99  0

kthr(內核線程)

工作負載分區 (WPAR)

Procs 
r: 等待運行的進程數 b: 處在非中斷睡眠狀態的進程數 w: 被交換出去的可運行的進程數。此數由 linux 計算得出,但 linux 並不耗盡交換空間 
Memory 
swpd: 虛擬內存使用情況,單位:KB
free: 空閒的內存,單位KB
buff: 被用來做爲緩存的內存數,單位:KB
Swap 
si: 從磁盤交換到內存的交換頁數量,單位:KB/秒
so: 從內存交換到磁盤的交換頁數量,單位:KB/秒
IO 
bi: 發送到塊設備的塊數,單位:塊/秒
bo: 從塊設備接收到的塊數,單位:塊/秒
System 
in: 每秒的中斷數,包括時鐘中斷
cs: 每秒的環境(上下文)切換次數
CPU 
按 CPU 的總使用百分比來顯示 
us: CPU 使用時間
sy: CPU 系統使用時間
id: 閒置時間
準測
r,b≈0,
如果fre,將會出現連續不斷的頁面調度,將導致系統性能問題。
對於page列,re,pi,po,cy維持於比較穩定的狀態,PI率不超過5,如果有pagin發生,那麼關聯頁面必須先進行pageout
在內存相對緊張的環境下pagein會強制對不同的頁面進行steal操作。如果系統正在讀一個大批的永久頁面,你也許可以看到po和pi列

會出現不一致的增長,這種情景並不一定表明系統負載過重,但是有必要對應用程序的數據訪問模式進行見檢查。在穩定的情況下,掃描率和重置率幾乎相等,在
多個進程處理使用不同的頁面的情況下,頁面會更加不穩定和雜亂,這時掃描率可能會比重置率高出。
faults列,in,sy,cs會不斷跳躍,這裏沒有明確的限制,唯一的就是這些值最少大於100
cpu列,us,sys,id和wa也是不確定的,最理想的狀態是使cpu處於100%工作狀態,單這隻適合單用戶的情況下。
如果在多用戶環境中us+sys》80,進程就會在運行隊列中花費等待時間,響應時間和吞吐量就會下降。wa>40表明磁盤io沒有也許存在不合理的平衡,或者對磁盤操作比較頻繁,
vmstat各項:
procs: 
r-->
在運行隊列中等待的進程數 
b-->在等待io的進程數
 
w-->可以進入運行隊列但被替換的進程
 
memoy 
swap-->現時可用的交換內存(k表示)
 
free-->空閒的內存(k表示)
 
pages 
re--》回收的頁面
 
mf--》非嚴重錯誤的頁面
 
pi--》進入頁面數(k表示)
 
po--》出頁面數(k表示)
 
fr--》空餘的頁面數(k表示)
 
de--》提前讀入的頁面中的未命中數
 
sr--》通過時鐘算法掃描的頁面
 
disk 顯示每秒的磁盤操作。 s表示scsi盤,0表示盤號
 
fault 顯示每秒的中斷數
 
in--》設備中斷
 
sy--》系統中斷
 
cy--》cpu交換
 
cpu 表示cpu的使用狀態
 
cs--》用戶進程使用的時間
 
sy--》系統進程使用的時間
 
id--》cpu空閒的時間
 
如果 r經常大於 4 ,且id經常少於40,表示cpu的負荷很重。
 
如果pi,po 長期不等於0,表示內存不足。
 
如果disk 經常不等於0, 且在 b中的隊列 大於3, 表示 io性能不好。

Linux在具有高穩定性、可靠性的同時,具有很好的可伸縮性和擴展性,能夠針對不同的應用和硬件環境調整,優化出滿足當前應用需要的最佳性能。因此企業在維護Linux系統、進行系統調優時,瞭解系統性能分析工具是至關重要的。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章