AIX程式記憶體佔用數的計算
昨天分析了Linux程式記憶體佔用數的計算。
今天,我們來分析下AIX下程式記憶體佔用。
AIX man ps
提示"RSS (v flag) The real-memory (resident set) size of the process (in 1KB units)."
但與linux一樣,RSS並不是程式實際佔用實體記憶體的大小。
下面是IBM官方的詳細解釋:
RSS:
Real-memory (resident set) size in kilobytes of the process. This
number is equal to the sum of the number of working segment and code segment
pages in memory times 4. Remember that code segment pages are
shared among all of the currently running instances of the program
TRS : Size of the resident set (real memory) of text. This is the number of code segment
pages times 4. This number exaggerates memory use for programs of which
multiple instances are running.
見下面命令:
[oracle@gxtest] $ps axv |head -1;ps axv | grep oracle | head -10
PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
33118 - A 0:00 0 8436 106112 xx 88895 97676 0.0 0.0 oracle
946452 - A 0:00 0 8436 106112 xx 88895 97676 0.0 0.0 oracle
1360266 - A 0:00 0 8436 106112 xx 88895 97676 0.0 0.0 oracle
1970596 - A 0:00 0 8440 106116 xx 88895 97676 0.0 0.0 oracle
2838910 - A 0:00 0 8424 106100 xx 88895 97676 0.0 0.0 oracle
2949614 - A 0:00 0 9372 107048 xx 88895 97676 0.0 0.0 oracle
2970004 - A 0:16 0 9028 106704 xx 88895 97676 0.1 0.0 oracle
...
上面所有oracle的程式trs都為97676,是所有oracle程式共享的,所以他們的trs都一樣。
我們可以使用RSS-TRS做為程式的佔用記憶體,實際上RSS-TRS就是SIZE。
見SIZE的解釋:
SIZE Virtual size (in paging space) in kilobytes of the data section of the process
(displayed as SZ by other flags). This number is equal to the number of working
segment pages of the process that have been touched times 4. If some working
segment pages are currently paged out, this number is larger than the amount of
real memory being used. SIZE includes pages in the private segment and the
shared-library data segment of the process.
看上面ps結果中的size對應的資料基本在8m左右,即oracle的server process
佔用的實體記憶體在8m左右。
再使用nmon看看:
[root@GXDB1:/]#nmon -r oracle
+-topas_nmon--S=WLMsubclasses----Host=GXDB1----------Refresh=2 secs---11:37.14---------------------
| Top-Processes-(4279) ----Mode=3 [1=Basic 2=CPU 3=Perf 4=Size 5=I/O 6=Cmds]----------------------
| PID %CPU Size Res Res Res Char RAM Paging Command
| Used KB Set Text Data I/O Use io other repage
|44564902 94.2 201840 244616 131648 112968 0 0% 0 1832 0 oracle
|27657376 93.4 94536 137316 131648 5668 4 0% 0 0 0 oracle
|46924802 82.0 98412 141192 131648 9544 5 0% 0 77 0 oracle
|16844250 74.4 105400 148180 131648 16532 28 0% 0 0 0 oracle
|60555840 30.0 95912 138692 131648 7044 892 0% 0 0 0 oracle
|33686028 28.3 101872 144652 131648 13004 15 0% 0 0 0 oracle
| 4786076 22.5 105308 148088 131648 16440 399 0% 0 0 0 oracle
| 7602648 21.3 95816 138596 131648 6948 25055 0% 0 0 0 oracle
|17236030 20.7 99892 142672 131648 11024 67 0% 0 144 0 oracle
|26018880 19.0 99056 141836 131648 10188 45 0% 0 0 0 oracle
|46269150 17.5 129028 126620 3844 122776 18845 0% 0 0 0 extract
|36110992 16.3 122768 120288 3740 116548 18806 0% 0 0 0 extract
|46203274 15.8 96684 139464 131648 7816 335 0% 0 4050 0 oracle
|23069706 15.4 99968 142748 131648 11100 30 0% 0 0 0 oracle
| Top-Processes-(4279) ----Mode=3 [1=Basic 2=CPU 3=Perf 4=Size 5=I/O 6=Cmds]----------------------
| PID %CPU Size Res Res Res Char RAM Paging Command
| Used KB Set Text Data I/O Use io other repage
|44564902 94.2 201840 244616 131648 112968 0 0% 0 1832 0 oracle
|27657376 93.4 94536 137316 131648 5668 4 0% 0 0 0 oracle
|46924802 82.0 98412 141192 131648 9544 5 0% 0 77 0 oracle
|16844250 74.4 105400 148180 131648 16532 28 0% 0 0 0 oracle
|60555840 30.0 95912 138692 131648 7044 892 0% 0 0 0 oracle
|33686028 28.3 101872 144652 131648 13004 15 0% 0 0 0 oracle
| 4786076 22.5 105308 148088 131648 16440 399 0% 0 0 0 oracle
| 7602648 21.3 95816 138596 131648 6948 25055 0% 0 0 0 oracle
|17236030 20.7 99892 142672 131648 11024 67 0% 0 144 0 oracle
|26018880 19.0 99056 141836 131648 10188 45 0% 0 0 0 oracle
|46269150 17.5 129028 126620 3844 122776 18845 0% 0 0 0 extract
|36110992 16.3 122768 120288 3740 116548 18806 0% 0 0 0 extract
|46203274 15.8 96684 139464 131648 7816 335 0% 0 4050 0 oracle
|23069706 15.4 99968 142748 131648 11100 30 0% 0 0 0 oracle
上面 Res Set 對應 ps 中的rss;Res Text即為trs;Res Data 即為佔用的實體記憶體。
附:
Memory usage determination with the ps command
The ps command can also be used to monitor memory usage of individual processes.
The ps v PID command provides the most comprehensive report on memory-related statistics for an individual process, such as:
- Page faults
- Size of working segment that has been touched
- Size of working segment and code segment in memory
- Size of text segment
- Size of resident set
- Percentage of real memory used by this process
The following is an example:
# ps v
PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
36626 pts/3 A 0:00 0 316 408 32768 51 60 0.0 0.0 ps v
The most important columns on the resulting ps report are described as follows:
PGIN Number of page-ins caused by page faults. Since all I/O is classified as page faults, this is basically a measure of I/O volume. SIZE Virtual size (in paging space) in kilobytes of the data section of the process (displayed as SZ by other flags). This number is equal to the number of working segment pages of the process that have been touched times 4. If some working segment pages are currently paged out, this number is larger than the amount of real memory being used. SIZE includes pages in the private segment and the shared-library data segment of the process. RSS Real-memory (resident set) size in kilobytes of the process. This number is equal to the sum of the number of working segment and code segment pages in memory times 4. Remember that code segment pages are shared among all of the currently running instances of the program. If 26 ksh processes are running, only one copy of any given page of the ksh executable program would be in memory, but the ps command would report that code segment size as part of the RSS of each instance of the ksh program. TSIZ Size of text (shared-program) image. This is the size of the text section of the executable file. Pages of the text section of the executable program are only brought into memory when they are touched, that is, branched to or loaded from. This number represents only an upper bound on the amount of text that could be loaded. The TSIZ value does not reflect actual memory usage. This TSIZ value can also be seen by executing the dump -ov command against an executable program (for example, dump -ov /usr/bin/ls). TRS Size of the resident set (real memory) of text. This is the number of code segment pages times 4. This number exaggerates memory use for programs of which multiple instances are running. The TRS value can be higher than the TSIZ value because other pages may be included in the code segment such as the XCOFF header and the loader section. %MEM Calculated as the sum of the number of working segment and code segment pages in memory times 4 (that is, the RSS value), divided by the size of the real memory in use, in the machine in KB, times 100, rounded to the nearest full percentage point. This value attempts to convey the percentage of real memory being used by the process. Unfortunately, like RSS, it tends the exaggerate the cost of a process that is sharing program text with other processes. Further, the rounding to the nearest percentage point causes all of the processes in the system that have RSS values under 0.005 times real memory size to have a %MEM of 0.0.
Note: The ps command does not indicate memory consumed by
shared memory segments or memory-mapped segments. Because many applications use
shared memory or memory-mapped segments, the svmon command is a better tool to view the memory
usage of these segments.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/195110/viewspace-764380/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- node計算記憶體佔用記憶體
- MySQL記憶體佔用計算公式MySql記憶體公式
- 【AIX】記憶體AI記憶體
- [20191115]oracle例項佔用記憶體計算.txtOracle記憶體
- 怎樣計算Bitmap的記憶體佔用和Bitmap載入優化記憶體優化
- python物件的記憶體佔用Python物件記憶體
- 寫個方法近似計算指定陣列或物件佔用記憶體的大小陣列物件記憶體
- influxdb記憶體佔用剖析UX記憶體
- 資源記憶體佔用記憶體
- 淺談深度學習:如何計算模型以及中間變數的視訊記憶體佔用大小深度學習模型變數記憶體
- win10記憶體佔用過高程式沒多少怎麼辦 win10記憶體佔用過高的方法Win10記憶體
- AIX詳細檢視使用者/程式使用記憶體AI記憶體
- mariadb 記憶體佔用優化記憶體優化
- 託管堆記憶體佔用記憶體
- 開源大模型佔GPU視訊記憶體計算方法大模型GPU記憶體
- Win10記憶體佔用過多怎麼辦 win10清理記憶體佔用的方法Win10記憶體
- 高階記憶體管理程式設計指南-實用的記憶管理記憶體程式設計
- Java 程式佔用 VIRT 虛擬記憶體超高的問題研究Java記憶體
- DOTNET記憶體佔用最佳化記憶體
- Android中一張圖片佔據的記憶體大小是如何計算Android記憶體
- 請問60*80的canvas佔多少記憶體?你是怎麼計算的?Canvas記憶體
- 如何檢視MySQL資料庫佔多大記憶體,佔用太多記憶體怎麼辦?MySql資料庫記憶體
- 電腦記憶體佔用過高怎麼辦 電腦記憶體佔用過高解決方法記憶體
- win10如何查詢哪些應用記憶體佔用大 win10如何檢視軟體記憶體佔用Win10記憶體
- 如何讓手遊記憶體佔用更小?從記憶體消耗iOS實時統計開始記憶體iOS
- Java中的CPU佔用高和記憶體佔用高的問題排查Java記憶體
- Windbg分析高記憶體佔用問題記憶體
- 檢視LINUX程式記憶體佔用情況Linux記憶體
- Java逐層解析JSON的記憶體佔用分析JavaJSON記憶體
- 手機記憶體卡大小的計算記憶體
- 檢視PHP-FPM的記憶體佔用、程序個數等資訊PHP記憶體
- 分析並優化 Android 應用記憶體佔用優化Android記憶體
- win10怎麼關閉佔用記憶體的服務_win10關掉佔用記憶體服務方法Win10記憶體
- 企業應用的轉折點:記憶體計算技術記憶體
- Linux/Centos檢視程式佔用記憶體大小的幾種方法總結LinuxCentOS記憶體
- Netweaver工作程式的記憶體限制 VS CloudFoundry應用的記憶體限制記憶體Cloud
- Java應用程式中的記憶體洩漏及記憶體管理Java記憶體
- 深度解讀昇騰CANN記憶體複用技術,降低網路記憶體佔用記憶體
- oracle RDBMS Kernel Executable 佔用記憶體過高Oracle記憶體