Process memory usage

hi all gurus:

I want to find out Solaris process memory usage, but got a bit confused, see if any one can provide me some guidance.

i tend to use prstat -a to get total memory consumption by user (I know prstat likely have a bug that simply sum up the memory, regardless if the memory being shared memory). Based on this command this hvr have a rss size of 121G .

prstat -a
 NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU
     6 hvr       120G  121G    47%   3:05:36 0.1%

then goes to ps , only two processes under hvr, with rss of 588400 + 41212 bytes, this appears varied a lot with above prstat output

$ ps -eo user,pid,project,taskid,args,rss|sort

    USER   PID  PROJECT TASKID COMMAND                                                                           RSS
     hvr  7289   system 881828 /export/home/hvr/HVR_HOME/bin/hvr -r -EHVR_HOME=/export/home/hvr/HVR_HOME -EHVR  41212
     hvr  7291   system 881829 /export/home/hvr/HVR_HOME/bin/hvr -r -EHVR_HOME=/export/home/hvr/HVR_HOME -EHVR  588400

goes to prstat -t , the project 881829 and 881829 under hvr have rss of 4594M + 4296M

$ prstat -T
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
  8177 hvr        60G 4594M sleep   49    0   1:07:19 0.0% oracle/2
  7306 hvr        60G 4296M sleep   59    0   0:31:05 0.0% oracle/2

goes to prstat -J , then the project 881829 and 881829 under hvr have rss of 60G + 61G, which tend to match with prstat -a

prstat -J

TASKID    NPROC  SWAP   RSS MEMORY      TIME  CPU PROJECT
881828        1   60G   60G    24%   1:11:55 0.0% system
881829        1   60G   61G    24%   0:33:36 0.0% system

i am very confused, how to accurately find out how much memory process consume in solaris? thanks

Outside the possible shared segment issue with prstat aggregations, all the commands accurately report how much memory is consumed. The main difference lies with the set of processes that are selected, six with "prstat -a", two with "ps", two different ones with "prstat -T".

You should first define the set of processes you want to measure the memory usage.

Then, a first approximation would be to sum up their RSS and SIZE columns as reported by the ps command. Should you suspect the value is over the actual usage, you can dig up each process memory usage with "pmap -x" and identify which segments are shared and their size.

2 Likes

thanks.

if i do a --> prstat -a -u to focus only the processof hvr, following is the output, RSS at top portion and bottom portion just do not close at all. top and bottom portion both showed 2 process (nproc)

   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
  7291 hvr       709M  627M sleep   59    0   0:42:53 0.0% hvr/1
  7289 hvr        90M   40M sleep   59    0   1:33:56 0.0% hvr/1

 NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU
     2 hvr       121G  121G    47%   2:16:49 0.0%

Total: 2 processes, 2 lwps, load averages: 2.21, 1.90, 1.85

What Solaris release is this?
Are zones involved?
Why was there six processes belonging to hvr in the "prstat -a" first posting output and only two in the last one?
What is the output of "prstat -s rss -c 1 1"?

thanks, yes, there is a zone setup, can the prstat in one zone be impacted by process from other zones?

$ prstat -s rss -c 1 1
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 13241 oracle     60G   46G sleep   59    0   3:48:47 0.0% oracle/2
 25852 oracle     60G   44G sleep   59    0   3:35:31 0.0% oracle/2
  4946 oracle     60G   44G sleep   59    0   3:48:46 0.0% oracle/2
 25849 oracle     60G   44G sleep   59    0   3:37:50 0.0% oracle/2
   219 oracle     60G   42G sleep   59    0   0:35:34 0.0% oracle/2
   214 oracle     60G   42G sleep   59    0   0:35:25 0.0% oracle/2
   223 oracle     60G   42G sleep   59    0   0:35:07 0.0% oracle/2
   229 oracle     60G   41G sleep   59    0   0:35:28 0.0% oracle/2
 23824 oracle     60G   41G sleep   59    0   2:24:48 0.0% oracle/2
 23953 oracle     60G   41G sleep   59    0   2:29:03 0.0% oracle/2
 23828 oracle     60G   40G sleep   59    0   2:19:45 0.0% oracle/2
 23951 oracle     60G   39G sleep   59    0   2:24:30 0.0% oracle/2
   201 oracle     60G   39G sleep   59    0   0:22:42 0.0% oracle/2
   209 oracle     60G   39G sleep   59    0   0:22:32 0.0% oracle/2
   205 oracle     60G   39G sleep   59    0   0:21:34 0.0% oracle/2
Total: 450 processes, 800 lwps, load averages: 3.68, 3.38, 2.96
$ uname -a
SunOS hostname 5.10 Generic_147441-05 


No, unless you run prstat in the global zone which has full non global zone visibility.

Otherwise, perhaps are there transient processes running under the hvr account sharing memory with the oracle processes.