cancel
Showing results for 
Search instead for 
Did you mean: 

Swap space utilization

 
SOLVED
Go to solution
Highlighted
Advisor

Swap space utilization

Hello,

is there any way how to find out how much swap space a process has reserved/allocated?
I am facing a large swap space utilization on some systems and want to find out what application causes this behaviour. It's for sure being caused by SAP and Oracle, but I would like to see some exact numbers.

Thanks for any helpful answer.
6 REPLIES 6
Highlighted
Honored Contributor
Solution

Re: Swap space utilization


Hi ,

Try this

#UNIX95= ps -e -o vsz,uid,pid,ruser,args |sort -rn |more

(one line command)

Aneesh
Highlighted
Exalted Contributor

Re: Swap space utilization

Shalom,

Overall:
swapinfo -tam

http://www.hpux.ws/?p=6
http://www.hpux.ws/?p=8

The second link includes a memory leak detector, which may help you spot a leak of ORACLE or SAP

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Highlighted
Advisor

Re: Swap space utilization

Thanks guys.

Here's an example from my test system:

bigboy:(/tmp)(root)#UNIX95= ps -e -o vsz,uid,pid,ruser,args |sort -rn | head -7
5364 0 2563 root /usr/sbin/stm/uut/bin/tools/monitor/fpl_em
4764 30 1726 www /opt/hpws/apache/bin/httpd -d /opt/hpws/apache -k start
4544 0 1519 root /opt/samba/bin/smbd -D -s /etc/opt/samba/smb.conf
4544 0 1489 root /opt/samba/bin/smbd -D -s /etc/opt/samba/smb.conf
4068 0 1208 root /opt/dce/sbin/rpcd
3740 30 1727 www /opt/hpws/apache/bin/httpd -d /opt/hpws/apache -k start
3484 0 1707 root /opt/hpws/apache/bin/httpd -d /opt/hpws/apache -k start

bigboy:(/tmp)(root)#swapinfo -mt
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 0 4096 0% 0 - 1 /dev/vg00/lvol2
reserve - 141 -141
memory 1185 260 925 22%
total 5281 401 4880 8% - 0 -
bigboy:(/tmp)(root)#

If I get it right then although this system is not swapping anything, the summary of the numbers in the VSZ column from the 'ps' output(in kB) should be equal to the reserved MB value in the swapinfo output. Is that right?
Highlighted
Honored Contributor

Re: Swap space utilization

No, I'm afraid not.

There are a few things which will complicate this sort of calculation:

1) mmap() using MAP_FILE when the mapping is not MAP_PRIVATE (or is MAP_PRIVATE but all accesses are read). These objects will use virtual address space (and therefore show in VSZ [as they should]) but need no swap reservation because the object is backed by the file, not the swap area.

2) Shared memory segments -- each segment will contribute to the VSZ of each attached process [i.e. a 1Mb (virtual) segment will contribute 1Mb of VSZ to each of processes A, B and C if each is attached].

And probably some other nuances that are slipping my brain this early. What you really want is reported via pstat -- I think top and ps just don't have columns for it. Take a look at the attached program. Fair warnings/disclaimers: This is my own quick work, not production code. I haven't compiled it on anything older than r11.23 (though I think I handle prior releases... I just wouldn't want to bet the farm on it).

If you compile 32-bit, I'd use the -D_PSTAT64 option... compile with +DD64 and you won't need to.

The important field is the pst_swap field from the pst_vm_status structure for each object in the process(es) you care about... that's the swap reservation consumption. You should be able to use that to find your heavy hitters (and know if they're shared objects or whatnot).
Highlighted
Advisor

Re: Swap space utilization

Thanks a lot.

I'll check your code on a test system and then consider the distribution to customer systems (won't be easy with over 1000 systems though).

Regards
Highlighted
Advisor

Re: Swap space utilization

.