Memory bottlenecks are evidenced by two different things happening on the system.
- Paging
- Page in;something is moved into Active RAM whether that is from Inactive RAM, the swapfile(s), or another file on the hard drive.
- Page out;anything is moved out from Active RAM to Inactive RAM, as well as writing to a Swapfile. Also in some cases, high page out means your system has run out of memory and had to use some of the Hard Disk instead of RAM.
- Page in;something is moved into Active RAM whether that is from Inactive RAM, the swapfile(s), or another file on the hard drive.
- Swapping
Paging refers to memory pages being reclaimed by the system page daemon, when system faces with lack of free memory.Swapping is more extreme and it means that processed being swapped out. Determine if system is only paging or swapping you should check two columns in “vmstat” output. The first result you need to check is “scan rate (sc)”.If this result is different from “0” then it means page daemon scans for free memory pages to put in them on the free list to be reused.
Page scan runs: default value is 1/64th of total physical memory or cache free.
Don’t worry about high scan rate if you are using the file system heavily. If priority_paging is enable high scan rate can be normal in many circumstances. If priority_paging is enabled then page scanners daemon steals pages more effectively. So the file system I/O does not cause unnecessary paging of process.
Check “w” column to see if system is swapping. It shows entire processes which are swapped out. If “w” column is different from 0, system is either low on memory right now, or have been in the past.
Use this command to see which processes are running .Don’t forget that check for RSS column if it’s 0 (sched, pageout and fsflush processes should always have a RSS of 0). If not then it means that system is swapping out.
Scan Rate And “w” Column:
#vmstat 1 2 kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr lf lf s2 s3 in sy cs us sy id 0 0 5 2304856 1352240 128 318 0 0 0 0 5 0 0 -0 5 661 28851 667 78 4 18 0 0 22 3802064 3028192 27 33 0 0 0 0 0 0 0 0 0 623 35757 466 98 2 0
RSS check: RSS column must be “0” for this check.If not system is low on memory right now.
#/usr/bin/ps -e -o pid,rss,args|egrep 'sched|pageout|fsflush'|grep -v grep PID RSS COMMAND 0 0 sched 2 0 pageout 3 0 fsflush
Page Out, Page in:
# vmstat 1 5|awk '{print $8 " " $9}' pi po 325 1942 0 6581 0 6376 0 5851 0 6576
Check Free Memory:
# sar -r 1 1000 SunOS opscgmrtep00 5.10 Generic_150400-18 sun4v 10/16/2015 16:08:58 freemem freeswap 16:08:59 116382376 2015530288
How to calculate sar free memory usage?
Parameter | Size | Total Free Size |
Free Mem | GB | Free Memory*8 /1024/1024/1024 |
Free Swap | GB | Free Swap * 512 /1024 /1024/1024 |
Pagesize for Oracle Solaris is 8K.
How to check page size on Oracle Solaris ?
# pagesize 8192
How to check free memory on Oracle Solaris?
#echo ::memstat|mdb -k Page Summary Pages MB %Tot ------------ ---------------- ---------------- ---- Kernel 653403 5104 8% ZFS File Data 1062828 8303 13% Anon 3278738 25615 40% Exec and libs 19061 148 0% Page cache 153244 1197 2% Free (cachelist) 18087 141 0% Free (freelist) 3050836 23834 37% Total 8236197 64345 Physical 8190736 63990
How to check process memory usage on Oracle Solaris?
This command will sort processes by memory usage(RSS ).If you need change sort option for Virtual Size.
# ps -ely|grep -v PID|sort -nrk8|more