Operating System - HP-UX
1821808 Members
3259 Online
109638 Solutions
New Discussion юеВ

Glance "RES Mem" and PS vsz differences

 
David Snider
Frequent Advisor

Glance "RES Mem" and PS vsz differences

Hello All,
I've been searching the Forums for ways of determining process memory usage.. I have found that I prefer Glance, but I've also been playing with a command that I see frequently, namely the old UNIX95= ps -e -o ruser,vsz,pid,args |sort -rnk2|more..

I am a little confused as in Glance, my Oracle processes show up as about 5~6MB, but with the ps command, they show up as about 30MB.. Am I doing something wrong? Thanks..

4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: Glance "RES Mem" and PS vsz differences

Hi David:

Take a look at document #A4678152 ("Comparing page size for vmstat, top, glance, ps -el").

/begin_quote/

1. Top reports free memory in 1kb chunks so to get them to match you must divide tops free amount by 4 to get the true number of 4kb pages free and have it match vmstat. In other words, top reports in 1kb pages so these numbers must be multiplied by 4 to get 4kb kernel pages numbers.

2. For vmstat, avm (active virtual pages) and free (size of the free list) memory are reported in 4kb pages sizes.

3. Glance reports 1kb page sizes. This number will often be significantly different from ps -el since glance reports usage of shared memory also.

From the Glance help window for RSS (* PROC_MEM_RES): The number of KB of resident memory for the process. This consists of text, data, stack, as well as the process' portion of shared memory. This value is similar to the SZ field of the ps -el command, except that the ps command shows only data, stack, and text areas, and it reports their sizes in page units rather than KB. On some systems ps reports the virtual rather than
resident size.

4. ps -el reports in 4kb kernel page sizes.

/end_quote/

...JRF...
David Snider
Frequent Advisor

Re: Glance "RES Mem" and PS vsz differences

Oh, ok.. So basically, the vsz does show information in KB, except, it is not comparing the same stuff that Glance is because glance shows more stuff.. The interesting thing is, according to this snippet from the MAN page for ps and glance..

/Begin Quote/

vsz = The size in kilobytes (1024 byte units) of the core image of the process. See column sz, above.
sz = The size in physical pages of the core image of the process, including text, data, and stack space.

Glance RSS = RSS(* PROC_MEM_RES): The number of KB of resident memory for the process. This consists of text, data, stack, as well as the process' portion of shared memory. This value is similar to the SZ field of the ps -el command, except that the ps command shows only data, stack, and text areas.

/End Quote/

So I would assume that the Process Size in Glance would be larger, since it shows more than PS...
But according to the info I see below, glance is showing my process to actually be smaller than what PS is showing... Am I still reading this correct?

GLANCE:
Process Name PID PPID RSS Cnt
----------------------------------------
oraclePWTKN 25056 1 5.3mb 1

PS:
user vsz pid ppid args
oracle 30468 25056 1 oraclePWTKN
Mladen Despic
Honored Contributor

Re: Glance "RES Mem" and PS vsz differences

David,

This reminds me of a strange memory report by Glance on our Sybase server.

Try creating a glance report by saving the attached file to, say, /tmp/shmem.syntax and running:

glance -adviser_only -syntax /tmp/shmem.syntax

This will list every process that has attached itself to a shared memory segment. It should also list its RSS and VSS values as well as RSS and VSS for each memory region.

Also run 'ipcs -mopb' and notice the number of attachments to shared memory segments. The size of each segment should match the "SHMEM Region VSS" from the glance report.

Under NATTACH, you can observe the number of attachments for each shared memory segment. Can you identify those processes in the glance report? (On our server, 'ipcs -mopb' shows 16 attachments for a particular shared memory segment, but the glance report shows only 4 processes attached to this segment.)

If a process is attached to a shared memory segment, its RSS value includes only a portion of this segment. On 11.00 systems, this portion of the shared memory is calculated as the size of the segment divided by the number of attachments. But if the kernel reports 16 attachments for a segment used by only 4 processes, then the reported RSS values will be too low.

HP says this should be corrected under 11i.

Mladen
David Snider
Frequent Advisor

Re: Glance "RES Mem" and PS vsz differences

Mladen,
Thanks for the attachment.. Basically, it sounds like Glance just basically guesses based on the number of connections to shared memory segments.. I can understand that.. Thanks for the file though.. it proved to be very helpful..