iT邦幫忙

DAY 26
4

Linux系統效能調教系列 第 26

Linux系統效能分析與探討 - [26] 系統記憶體監視工具 - pidstat

pidstat可以監視特定process(指定PID),或是全系統的記憶體使用狀況,他是追蹤memory leak非常方便的工具。當我們看到某一個process使用的記憶體不斷的增加,也就是調用後都沒有free掉,那就是有memory leak的狀況了。這樣的程式必須盡快處理,否則不儘程式可能會當掉,也會拖垮整體系統的效能。

pidstat 2 -r

06:06:14 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
06:06:16 PM      5844      0.99      0.00   54396   1512   0.01  automount
06:06:16 PM      5893      0.49      0.00  316712   4640   0.04  iscmsvc
06:06:16 PM     24691    475.86      0.00   59652   1372   0.01  pidstat

06:06:16 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
06:06:18 PM      5893      0.50      0.00  316712   4640   0.04  iscmsvc
06:06:18 PM     24691    486.50      0.00   59652   1408   0.01  pidstat

06:06:18 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
06:06:20 PM      5893      0.50      0.00  316712   4640   0.04  iscmsvc
06:06:20 PM     24691    482.00      0.00   59652   1408   0.01  pidstat

06:06:20 PM       PID  minflt/s  majflt/s     VSZ    RSS   %MEM  Command
06:06:22 PM      5322      1.50      0.00   10760    400   0.00  irqbalance
06:06:22 PM      5893      0.50      0.00  316712   4640   0.04  iscmsvc
06:06:22 PM     24691    482.00      0.00   59652   1408   0.01  pidstat

pidstat命令可以提供下列資訊:

PID: process ID

minflt/s: Minior page fault,又稱soft page fault每秒發生的次數。Minior page fault發生在記憶體有需要的page時,所以無須向磁碟讀取資料。

majflt/s: Major page fault,又稱hard page fault每秒發生的次數。Major page fault發生在連記憶體也找不到需要的page時,所以須向磁碟讀取資料。

VSZ: Virtual Size,整個工作的虛擬記憶體使用空間(KB)。

SS: Resident Set Size,整個工作的實體記憶體(非swap的部分)使用空間(KB)。

%MEM: 整個工作目前所使用的實體記憶體的比例。

Command: 目前執行的程式(工作)。

[本系列文章]
Linux系統效能分析與探討 - [1] CPU的效能關鍵字
Linux系統效能分析與探討 - [2] 記憶體的效能關鍵字
Linux系統效能分析與探討 - [3] Linux作業系統網路模組的效能關鍵字
Linux系統效能分析與探討 - [4] Linux block device的效能關鍵字
Linux系統效能分析與探討 - [5] 了解process的運作的指令 1 - ps
Linux系統效能分析與探討 - [6] 了解process的運作的指令2 - top
Linux系統效能分析與探討 - [7] 了解process的運作的指令3 - pstree
Linux系統效能分析與探討 - [8] 了解process使用記憶體的狀況 - pmap
Linux系統效能分析與探討 - [9] 顯示系統的附載狀況 - uptime, w
Linux系統效能分析與探討 - [10] 顯示系統的狀態 - vmstat
Linux系統效能分析與探討 - [11] 檢視記憶體的使用狀況 - free
Linux系統效能分析與探討 - [12] 取得詳細記憶體資訊 - cat /proc/meminfo
Linux系統效能分析與探討 - [13] Kernel slab cache的資訊 - slabtop
Linux系統效能分析與探討 - [14] Kernel buddy system 的內容 - /proc/buddyinfo
Linux系統效能分析與探討 - [15] slabinfo
Linux系統效能分析與探討 - [16] 系統使用狀態: mpstat, sar
Linux系統效能分析與探討 - [17] CPU與disk的狀態 - iostat
Linux系統效能分析與探討 - [18] 更豐富的iostat內容
Linux系統效能分析與探討 - [19] 多核心的記憶體管理狀態 - numactl與numastat
Linux系統效能分析與探討 - [20] 豪華的系統監看工具 - nmon
Linux系統效能分析與探討 - [21] 追蹤程式所呼叫的系統函式 - strace
Linux系統效能分析與探討 - [22] 網路診斷工具 ping, traceroute 與 netstat
Linux系統效能分析與探討 - [23] 網路及時監看工具 iptraf
Linux系統效能分析與探討 - [24] 獲取網路統計資料 sar -n DEV
Linux系統效能分析與探討 - [25] 取得系統記憶體資訊 sar -r


上一篇
Linux系統效能分析與探討 - [25] 取得系統記憶體資訊 sar -r
下一篇
Linux系統效能分析與探討 - [27] 找尋系統效能的瓶頸 - CPU
系列文
Linux系統效能調教31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言