Memory usage on Solaris 10

I needed to try and work out what was using the memory on one of my Solaris 10 boxes under test.

Check that no-one has created any large files under /tmp. By default on Solaris /tmp is mounted on swap, so any large files created in that directory will consume memory/swap until removed.

Use prstat to display processes ordered by memory used, and show a summary output of memory consumption by user.

prstat -a -s rss

root@ellg-v140-114 # prstat -a -s rss
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP      
 26692 tango    2077M 2064M sleep   59    0   0:00:02 0.0% M3UA_stack/7
 26702 tango    2077M 2064M sleep   59    0   0:00:02 0.0% M3UA_stack/7
 26676 tango     774M  771M sleep   59    0   0:00:01 0.0% msc/3
 26678 tango     774M  771M sleep   49    0   0:00:01 0.0% msc/3
 26675 tango     774M  771M sleep   59    0   0:00:01 0.0% msc/3
 26677 tango     774M  771M sleep   59    0   0:00:01 0.0% msc/3
 26681 tango     768M  765M sleep   59    0   0:00:01 0.0% msc/3
 26682 tango     768M  765M sleep   59    0   0:00:01 0.0% msc/3
 26664 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26665 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26666 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26669 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26668 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26667 tango     744M  740M sleep   59    0   0:00:01 0.0% MAP_router2/3
 26684 tango     343M  340M sleep   59    0   0:00:00 0.0% hlr/3
 NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU                            
    44 tango      16G   16G    50%   0:00:48 0.6%
   113 root      234M  227M   0.7%   0:26:02 0.8%
     1 noaccess  135M  115M   0.4%   0:03:53 0.0%
     6 daemon     10M 7616K   0.0%   0:00:01 0.0%
     1 smmsp    1900K 4240K   0.0%   0:00:01 0.0%
Total: 165 processes, 386 lwps, load averages: 0.61, 0.66, 0.43

Be careful with the output of this though, if your application has lots of processes connecting to a single shared memory segment (e.g. Oracle) then each of these will show up as a separate consumer of memory the same size as the shared memory segment.

Use memstat to have a peek at what the kernel memory usage is

root@ellg-v140-114 # echo "::memstat" |mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     353282              1380    4%
Anon                      5920763             23127   71%
Exec and libs               14034                54    0%
Page cache                  32185               125    0%
Free (cachelist)            11157                43    0%
Free (freelist)           2052859              8018   24%

Total                     8384280             32751
Physical                  8175445             31935

If you’re using ZFS check how much is being used by the ARCcache.

# kstat -m zfs |grep size
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s