Solaris 10 memory usage analysis
It so happens that I need to get a bit more insight into what’s eating all the RAM on one of my solaris boxes. Whenever this happens I can never remember all the various incantations, so I’m putting them all here for future reference.
Most of these need to run as root.
prstat -a -s rss
- Quick overview of top processes ordered by physical memory consumption, plus memory consumption per user. Note that if you have lots of processes all sharing (say) a 1GB bit of shard memory, each process will show up as using 1GB (very noticeable with oracle, where there can be 100 processes each with a hook into the multi-GB SGA)
ls -l /proc/{pid}/as
nice easy way to see the address space (total memory usage) for a single process. Good for when you want to see the memory usage of a set of processes which is too large to fit into prstat e.g. _
# is apache leaking? for pid in `pgrep httpd` do ls -l /proc/$pid/as done
vmstat -S 3
Am I swapping? watch the swap in/out columns; if they’re not 0, you need more RAM
vmstat 3
Am I thinking about swapping? The sr (Scan Rate) column tells you when you’re starting to run low on memory, and the kernel is scanning physical memory to find blocks that can be swapped out. c.f. Myth: Using swap is bad for performance
echo "::memstat" | mdb -k
How much memory is being used by the kernel and/or the (UFS) file system caches? (n.b. the kernel memory usage includes the ZFS ARC cache – see below) Warning this can take several minutes to run, and sucks up a lot of CPU time.
kstat -m zfs
How much memory is the ZFS ARC cache using? (n.b. if you have lots of ZFS data, this can be a very big number; the ARC cache will use up to (system RAM -1GB), but it should release RAM as soon as other apps need it.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/522544/viewspace-701648/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/522544/viewspace-701648/