View User/process memory in AIX

Source: Internet
Author: User

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 COMMANDroot 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 1: 17/opt/BESClient/pconsole 4456680 0.0 1.0 42456 42464-A Feb 20 11:29:26/usr/java5/bin/root 6750376 0.0 0.0 796 pts/0 A ps aux root 824 0.0 0.0 260 268-A Mar 13 11:29:26 auditbin root 6357208 0.0 0.0 236 pts/0 A sort-rn + 3 root 248 5963962 0.0 0.0-A Feb 20/usr /sbin/rsct/root 5832798 0.0 0.0 836-A 11:29:12 telnetd-a root 856 5570748 0. 0 2128 2096-A Feb 20/usr/sbin/rsct/root 5308652 0.0 0.0 7328 7436-A Feb 20 01/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-A Feb 20 11:36:45/usr/bin/topasrroot 1272 6160578 0.0 0.0 252 pts/0 grep topas, but sometimes ps aux does not show in detail the full usage of the process. 3, the root user svmon can be used to analyze Out-of-memory usage # svmon-G size inuse free pin virtual mmodememory 1048576 1037487 11089 229668 378796 Dedpg space 2097152 2360 work pers clnt otherpin 196952 0 0 32716in use 378796 0 658691 PageSize PoolSize inuse pgsp pin als 4 KB-793327 2360 49188 134636 m 64 KB-15260 0 11280 inuse: is the physical memory usage, which is measured in 4 K, so 1037487*4096 = 4249546752 (424 M) virtual: is the virtual memory usage, which is measured in 4 K, so 378796*4096 = 1551548416 (155 M) 4. display the three processes that use the maximum 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, and displays the three processes that use the most physical memory in the SWAp zone # svmon-gP-t 3 | grep-p Pid | grep & apos; ^. * [0-9] & apos; 1966206 shlap64 26782 8880 0 26771 Y N N 0 swapper 9872 8912 0 9872 y n 1 init 22094 8836 0 22076 N the first program X uses a swap zone of approximately 26782X4096 = 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, the maximum number of Vsid 4f08 segments is 7. svmon-pP 22674 indicates that processes with PID 22674 use the Pid Command nuse Pin Pgsp Virtual 64-bit Mthrd 22674 java 29333 1611 2756 n y Vsid Esid Type Description Inuse Pin Pgsp Virtual 0 0 work kernel seg 32404 2979 1593 1659 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 shmat/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 & apos; {print $1/256} & apos;) 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: & apos; {print $1} & apos; 'do svmon-U $ username | grep $ username "" done) usermem = 'echo "$ usermem" | grep-v "0 0 0 0" | awk & apos; {print $1, $2/256, "MB"} & apos; 'echo "singe user pmem" echo "$ userm Em "usermem = $ (echo" $ usermem "| awk & apos; BEGIN {sum1 = 0 ;}{ sum1 = sum1 + $2 ;}end {print sum1 ;} & apos;) usermem = $ (echo $ usermem | awk-F \. & apos; {print $1} & apos;) 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.