Operating System - HP-UX
1825671 Members
3569 Online
109686 Solutions
New Discussion

swap space used show in swapinfo -tam and Glance

 
Hanry Zhou
Super Advisor

swap space used show in swapinfo -tam and Glance

As you can see from following swapinfo -tam and glance, the swap on two devices has been used for 9%, and total of swap used shown in Glace is about 60%.

My questions are:

1. The swap space on devices, is this space currently being used at this moment, or is it the space that has been used previously?

2. since we are using the swap space pretty high, can we conclude that we have memory pressure? I know that it depends on if we have page outs, but, if we don't consider the page outs for now, can we make such conclusion?


# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 92 932 9% 0 - 1 /dev/vg00/lvol2
dev 1024 94 930 9% 0 - 1 /dev/vg00/lvol11
reserve - 1862 -1862
memory 4320 3289 1031 76%
total 6368 5337 1031 84% - 0 -


Current Avg High
Cpu Util S SRU U | 93% 97% 100%
Disk Util F F | 14% 18% 28%
Mem Util S SU UB B | 99% 99% 99%
Swap Util U UR R | 85% 85% 85%
none
9 REPLIES 9
Bill Hassell
Honored Contributor

Re: swap space used show in swapinfo -tam and Glance

No, you cannot assume you have memory pressure. Swap space is allocated in two ways: actual page outs that are stored in the swap area and swap reservation -- not occupied, just reserved in case it's needed at a later time. Glance bars have two parts, the reserved and the occupied. The summaries at the right simply show the combination. So, the total isn't of much use.

Since the combination of reserved and occupied swap space is 85%, you may need to add more swap space if more users and applications are to be added. You'll need enough swap space to cover both reservation and occupied space.

But, memory pressure can only be measured as page outs. These are 'real' deactivations in which portions of memory were written to swap. Page ins are meaningless for performance because all programs begin by being pahged in from the executable and possibly later, paged in from swap space.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: swap space used show in swapinfo -tam and Glance

Shalom,

Swap space use means its reserved. Your system is not under pressure until paging gets out of control and starts eating up available i/o.

vmstat can help you detect this.

The question I always ask myself before beginning peformance work is: Is system response, abnormally slow?

If the system is doing its job, it may be time to stop. If not, identify the exact cause and deal with it.

http://www.hpux.ws/system.perf.sh

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
Hanry Zhou
Super Advisor

Re: swap space used show in swapinfo -tam and Glance

I understand all you have said.

However, my question are:

1. since about 60% swap utilization from glance, and 9% of two devices from swapinfo -tam, are these figures showing the status of swap usage at this moment, or they are just reflection of accumulated figures?

2. no matter what, these are dada that have been swapped out into swap devices, so, page out did happend, or have happent. Maybe it is not swaping now, but did happend. Based on that, we could say we have memory pressure?

none
Bill Hassell
Honored Contributor

Re: swap space used show in swapinfo -tam and Glance

You asked:

> 1. since about 60% swap utilization from glance, and 9% of two devices from swapinfo -tam, are these figures showing the status of swap usage at this moment, or they are just reflection of accumulated figures?

The swapinfo figures (9%) are showing occupied swap while Glance's percentage combines reserved and occupied. So they are two different measurements. The bars in Glance are a better metric as they divide reserved and occupied.


> 2. no matter what, these are dada that have been swapped out into swap devices, so, page out did happend, or have happent. Maybe it is not swaping now, but did happend. Based on that, we could say we have memory pressure?

Mope. Swap space is also used by memory mapped files. There is no metric to separate these two uses. Thus, the only way to see memory pressure is page out rate. Glance is useful because it not only shows instantaneous page outs but cumulative values. As a rule of thumb, single digits (0-9) are fine (no performance issues), double digits (10-99) means memory pressure, and anything larger (100+) means your system is crawling.

Naturally, these numbers must exist for a long time (minutes to hours) to be meaningful. For instance, you could start a large fbackup and the large shared memory area might cause a jump in page outs for a minute, but only a few processes may get deactivated and paged out. But during the fbackup run, a program that must be reactivated will have it's pages returned to memory. The only time there is a concern is when many programs must all run at the same time -- then page outs will be continuous, and that shows memory pressure.


Bill Hassell, sysadmin
Hanry Zhou
Super Advisor

Re: swap space used show in swapinfo -tam and Glance

Understand.

9% is the occupied swap space on DISK DEVICES, and not in memory reserved area. So, in this sense, the swaping (page outs) activities did happend, and therefore, we were under memory pressure when swaping happent. right?

none
Bill Hassell
Honored Contributor

Re: swap space used show in swapinfo -tam and Glance

No, swap space is used by two very different tasks. Occupied space will exist whenever your applications use memory mapped files. You could have 32Gb of RAM, use a maximum of 5% of that RAM, and swap space will still be used by memory mapped files. The only way to determine if memory pressure has occurred is to monitor vmstat's po column or Glance's page out (better method) on a regular basis.


Bill Hassell, sysadmin
Hanry Zhou
Super Advisor

Re: swap space used show in swapinfo -tam and Glance

I guess, what I don't understand about is "memory mapped files", could you explain that concept a little bit more?

Sorry, I still don't get it. I thought, if we have enough memory, the the data will not be swapped to swap devices(disks).
none
James R. Ferguson
Acclaimed Contributor

Re: swap space used show in swapinfo -tam and Glance

Hi Hanry:

Memory mapped files grant you to the ability to read to and write from files that are shared between/among processes by loading all or a portion of the file into memory.

Instead of having to do I/O to access a file you can calculate the offset that represents the data you want and simply point to it, incrementing and decementing a pointer to traverse about.

One of the principal system calls used is 'mmap(2)' which estabishes the relationship between a process and its file. Part of calling 'mmap()' involves specifying whether you want read, write and/or executable permissions applied. You also have the ability to specify that changes your process makes to the memory-mapped region (file) are private or can be seen (ahared) by other processes. Have a look at the manpages for 'mmap(2)' and 'munmap(2)' for more details about mapping and unmapping files.

If you are going to share a memory-mapped file with other processes, you generally will regulate access to it with semaphores or "flags" to regulate when a process can read or write the memory-mapped file. After all, you wouldn't want two processes to write to a file at the same time. You want consistency among all processes view and control of the memory.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: swap space used show in swapinfo -tam and Glance

Memory mapped files are created by certain programs. You don't need to know much about them -- some programs use them, most do not. These files will use swap space regardless of how much RAM you have. The use of swap space for memory mapped files has nothing to do with lack of RAM. It is another use of the swap area.


Bill Hassell, sysadmin