Linux系統中vmstat的基本使用指南

來源:互聯網
上載者:User

vmstat 是用來即時查看記憶體使用量情況,反映的情況比用top直觀一些.
如果直接使用,只能得到當前的情況,最好用個時間間隔來採集
vmstat T 其中T用具體的時間標示,單位是 秒 例如:vmstat 5 表格每隔5秒採集一次.
這樣在重新整理的時候就能比較系統的看到那個列不正常的
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效能不好。

執行個體:

代碼如下:
[root@localhost ~]# vmstat 2 #每二秒顯示一次系統記憶體的統計資訊

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0      0 219908  62964 175548    0    0    47    12   12   17  0  1 99  0
 0  0      0 219900  62964 175548    0    0     0     0   11   12  0  0 100  0
 0  0      0 219900  62964 175548    0    0     0     0    9    9  0  0 100  0

代碼如下:
[root@localhost ~]# vmstat 2 5 #每二秒顯示一次系統記憶體的統計資訊,總共5次

procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0      0 219908  62964 175548    0    0    46    12   12   17  0  1 99  0
 0  0      0 219900  62964 175548    0    0     0     0   12   14  0  0 100  0
 0  0      0 219900  62964 175548    0    0     0     0   11   11  0  1 100  0
 0  0      0 219900  62964 175548    0    0     0     0   10   11  0  0 100  0
 0  0      0 219900  62964 175548    0    0     0     0   10    9  0  0 100  0

代碼如下:
[root@localhost ~]# vmstat -d #顯示磁碟資訊

disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
ram0       0      0       0       0      0      0       0       0      0      0
ram1       0      0       0       0      0      0       0       0      0      0
ram2       0      0       0       0      0      0       0       0      0      0
ram3       0      0       0       0      0      0       0       0      0      0
ram4       0      0       0       0      0      0       0       0      0      0
ram5       0      0       0       0      0      0       0       0      0      0
ram6       0      0       0       0      0      0       0       0      0      0
ram7       0      0       0       0      0      0       0       0      0      0
ram8       0      0       0       0      0      0       0       0      0      0
ram9       0      0       0       0      0      0       0       0      0      0
ram10      0      0       0       0      0      0       0       0      0      0
ram11      0      0       0       0      0      0       0       0      0      0
ram12      0      0       0       0      0      0       0       0      0      0
ram13      0      0       0       0      0      0       0       0      0      0
ram14      0      0       0       0      0      0       0       0      0      0
ram15      0      0       0       0      0      0       0       0      0      0
loop0      0      0       0       0      0      0       0       0      0      0
loop1      0      0       0       0      0      0       0       0      0      0
loop2      0      0       0       0      0      0       0       0      0      0
loop3      0      0       0       0      0      0       0       0      0      0
loop4      0      0       0       0      0      0       0       0      0      0
loop5      0      0       0       0      0      0       0       0      0      0
loop6      0      0       0       0      0      0       0       0      0      0
loop7      0      0       0       0      0      0       0       0      0      0
sda    12341   5909  471542  465300   1325   2081  127088   32204      0     19
sr0        0      0       0       0      0      0       0       0      0      0

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.