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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux程式記憶體佔用數的計算Linux記憶體
- AIX系統記憶體佔用率的計算AI記憶體
- node計算記憶體佔用記憶體
- MySQL記憶體佔用計算公式MySql記憶體公式
- filebeat實踐-記憶體佔用-最大記憶體佔用記憶體
- PHP計算出記憶體最高佔用.PHP記憶體
- AIX下程式記憶體分析AI記憶體
- 怎樣計算Bitmap的記憶體佔用和Bitmap載入優化記憶體優化
- 記憶體的計算記憶體
- 【AIX】記憶體AI記憶體
- C#獲取CPU佔用率、記憶體佔用、磁碟佔用、程式資訊C#記憶體
- 修改oracle記憶體佔用Oracle記憶體
- 資源記憶體佔用記憶體
- aix的記憶體使用AI記憶體
- 計算程式記憶體需求最小量記憶體
- 監控某程式記憶體佔用異常記憶體
- 淺談深度學習:如何計算模型以及中間變數的視訊記憶體佔用大小深度學習模型變數記憶體
- python物件的記憶體佔用Python物件記憶體
- 【AIX】AIX記憶體機制AI記憶體
- Linux檢視佔用記憶體的程式指令碼Linux記憶體指令碼
- 託管堆記憶體佔用記憶體
- influxdb記憶體佔用剖析UX記憶體
- AIX 5L 記憶體效能優化,第 1 部分: AIX Version 5.3 中記憶體的概述以及記憶體引數的優化AI記憶體優化
- win10記憶體佔用過高程式沒多少怎麼辦 win10記憶體佔用過高的方法Win10記憶體
- 開源大模型佔GPU視訊記憶體計算方法大模型GPU記憶體
- svchost.exe佔用很高的記憶體記憶體
- 如何觀察程式的記憶體佔用情況記憶體
- Win10記憶體佔用過多怎麼辦 win10清理記憶體佔用的方法Win10記憶體
- 減少.NET應用程式記憶體佔用的一則實踐記憶體
- mariadb 記憶體佔用優化記憶體優化
- AIX 記憶體監控AI記憶體
- Java 程式佔用 VIRT 虛擬記憶體超高的問題研究Java記憶體
- linux下查詢程式佔用的記憶體方法總結Linux記憶體
- 檢視PHP-FPM的記憶體佔用、程序個數等資訊PHP記憶體
- 如何讓手遊記憶體佔用更小?從記憶體消耗iOS實時統計開始記憶體iOS
- 高階記憶體管理程式設計指南-實用的記憶管理記憶體程式設計
- 用JavaScript計算字串佔用位元組數JavaScript字串
- 如何檢視MySQL資料庫佔多大記憶體,佔用太多記憶體怎麼辦?MySql資料庫記憶體