引用: Solaris 内存使用的命令

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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值