View user/process memory in AIX
Last Update:2014-05-15
Source: Internet
Author: User
AIX details user/process memory usage description: topas indicates that % comp memory is used 98% problem analysis: 1, arrange 10 memory usage processes from large to small psaux | head-1; psaux | sort-rn + 3 | head-10 for details :... AIX details user/process memory usage description: topas indicates that % comp memory is used 98% problem analysis: 1, process ps aux | head-1; ps aux | sort-rn + 3 | head-10 in ascending order of 10 memory usage. for details, see process: ps-ealf | head-1; ps-ealf | sort-rn + 9 | head-10 # ps aux | head-1; ps aux | sort-rn + 3 | head-10 user pid % CPU % MEM SZ RSS TTY STAT STIME TIME COMMAN Droot 6553834 0.1 3.0 115064 115080-A Feb 20 86: 08/var/opt/tivoliroot 5701730 0.0 1.0 17480 21956-A Mar 05/opt/BESClient/pconsole 4456680 0.0 1.0 42456-A Feb 20/usr/java5/bin/ root 6750376 0.0 0.0 796 824 pts/0 A 11:29:26 11:29:26 ps aux root 6488234 0.0 0.0 260-A Mar 13 auditbin root 268 6357208 0.0 0.0 236 pts/0 A sort- rn + 3 root 5963962 0.0 0.0 1768 1804-A Feb 20 11:29:12/usr/sbin/rsct/root 5832798 0.0 0.0 836-A telnetd-a root 856 5570748 0.0 0.0-A Feb 20/usr/ sbin/rsct/root 5308652 0.0 0.0 7328-A Feb 20/usr/sbin/rsct/2, view memory usage # ps aux | head-1; ps aux | grep topas based on a command or process name. for details, see: user pid % CPU % mem sz rss tty stat stime time COMMANDroot 2359426 0.0 0.0 1440 1272-A Feb 20/usr/bin/topas Rroot 6160578 0.0 0.0 252 264 pts/0 A 11:36:45 grep topas, but sometimes ps aux does not show in detail the full usage of the process 3, the root user svmon can analyze the memory usage # svmon-G size inuse free pin virtual mmodememory 1048576 1037487 11089 229668 378796 Dedpg space 2097152 2360 196952 work pers clnt otherpin 378796 0 0 0 32716in use 0 658691 PageSize PoolSize inuse pgsp pin tags ALS 4 KB-793327 2360 49188 134636 m 64 KB-15260 0 11280 in Use: the physical memory usage. here, the unit is 4 K, so 1037487*4096 = 4249546752 (424 M) virtual: the virtual memory usage. here, the unit is 4 K, therefore, 378796*4096 = 1551548416 (155 M) 4 shows the three processes that use the most physical memory: # svmon-uP-t 3 | grep-p Pid | grep '^. * [0-9] '2017 java 6553834 51279 0 8917 n y n 50938 java 4456680 34626 0 8874 n y n 34608 BESClient 5701730 29564 8882 0 25689 y n output format order is Pid command Inuse Pin Pgsp Virtual 64-bit Mthrd can calculate the actual memory used by the X program as 51279 × 4096 = 210038784, it is about 210 MB 5 Displays the three processes that use the maximum physical memory in the swap zone # svmon-gP-t 3 | grep-p Pid | grep' ^. * [0-9] '2017 shlap64 1966206 26782 0 8880 y n 0 swapper 26771 9872 0 8912 y n 1 init 9872 22094 0 8836 N the first program X used the swap zone size of is about 26782 × 4096 = 10510336 bytes, about 10 MB space 6, display the most used segments every three seconds # svmon-S-t 3-I 3 Vsid Esid Type Description Inuse Pin Pgsp Virtual 4f08-clnt 37505 0---11e1-clnt 33623 0--8811 -work kernel pinned heap 12637 6547 8091 19397 visible, Vsid 4f08 segments use up to 7, svmon-pP 22674 the PID 22674 processes use the Pid Command nuse Pin Pgsp Virtual 64-bit Mthrd 22674 java 29333 1611 2756 32404 n y Vsid Esid Type Description Inuse Pin pgsp Virtual 0 0 work kernel seg 2979 1593 1659 4561 a056-work 43 16 3 46 1e03 2 work process private 77 2 17 93 1080-pers/dev/hd2: 69742 1 0--f8bd f work shared library data 84 0 11 99 60ee 8 work shm At/mmap 0 0 0 0 70ec-pers/dev/hd2: 69836 1 0--8. run the ncheck command to check which files are used by the Vsid. Ncheck a056 Attachment 1: view the total physical memory # cat mem1.sh #! /Usr/bin/ksh # mem totle totalmem = $ (vmstat-v | head-n 1 | awk '{print $1/256}') echo "mem totle: "echo $ totalmem MB echo Attachment 2: view the amount of physical memory occupied by each user # cat mem2.sh usermem = $ (for username in 'cat/etc/passwd | awk-F: '{print $1}' do svmon-U $ username | grep $ username "" done) usermem = 'echo "$ usermem" | grep-v "0 0 0 0" | awk '{print $1, $2/256, "MB"} ''echo "singe user pmem" echo "$ usermem" usermem = $ (echo "$ usermem" | Awk 'In in {sum1 = 0 ;}{ sum1 = sum1 + $2 ;}end {print sum1 ;}') usermem =$ (echo $ usermem | awk-F \. '{print $1}') echo "singe user pmem:" $ usermem MB echo AIX5.3 check the memory usage of the system, user, and file system #! /Usr/bin/ksh # view the total memory size: totalmem =$ (vmstat-v | head-n 1 | awk '{print $1/256 }') echo "Total Memory (physical memory):" echo $ totalmem MB echo # view the memory used by each user: usermem = $ (for username in 'cat/etc/passwd | awk-F: '{print $1} ''do svmon-U $ username | grep $ username" "done) usermem = 'echo "$ usermem" | grep-v "0 0 0 0" | awk '{print $1, $2/256, "MB"} ''echo "user memory (physical memory ): "echo" $ usermem "usermem = $ (echo" $ usermem "| awk 'In in {sum1 = 0 ;}{ sum1 = sum1 + $2 ;}end {print sum1 ;} ') usermem = $ (echo $ usermem | awk-F \. '{print $1}') echo "user memory (physical memory) Total:" $ usermem MB echo # View File system cache: clientmem1 = 'svmon-G | grep "^ pin" | awk '{print $4} ''clientmem2 = 'svmon-G | grep" ^ in use "| awk' {print $5} ''clientmem = 'expr $ clientmem1 + $ clientmem2 'clientmem = 'expr $ clientmem/256 'echo "file system cache (physical memory): "echo $ clientmem MB echo # View system memory usage: sysmem = $ (svmon-S-s-u | cut-B 54-| grep-v "0 0 0 0" | grep [0-9] | awk '{print $ 1, $2} ') supremeseg = 'echo "$ sysmem" | grep S | awk' BEGIN {sum1 = 0 ;}{ sum1 = sum1 + $2 ;} END {sum1 = sum1 * 16*1024*1024; print sum1;} ''largeseg = 'echo "$ sysmem" | grep L | awk' BEGIN {sum1 = 0 ;} {sum1 = sum1 + $2;} END {sum1 = sum1 * 16*1024; print sum1 ;} ''mediumseg = 'echo "$ sysmem" | grep m | awk' BEGIN {sum1 = 0 ;}{ sum1 = sum1 + $2 ;}end {sum1 = sum1 * 64; print sum1;} ''smallseg = 'echo "$ sysmem" | grep s | awk' BEGIN {sum1 = 0 ;}{ sum1 = sum1 + $2 ;} END {sum1 = sum1 * 4; print sum1;} ''sysmem =$ (expr $ supremeseg + $ largeseg + $ mediumseg + $ smallseg) sysmem = $ (expr $ sysmem/1024) echo "system memory (physical memory):" echo $ sysmem MB echo # View idle memory: freemem = $ (vmstat-v | grep free | awk '{print $1/256}') echo "idle memory (physical memory ): "freemem = $ (echo $ freemem | awk-F \. '{print $1}') echo $ freemem MB echo