cancel
Showing results for 
Search instead for 
Did you mean: 

Free physical memory

Slaine
Occasional Contributor

Free physical memory

I should know this but thats senility kicking in

 

 

from the output below should I be reading it that there is currently 12gb of physical memory available to the system and 4.3gb is used.

 

:/ # swapinfo -mat
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev       12288       0   12288    0%       0       -    1  /dev/vg00/lvol2
dev       12288       0   12288    0%       0       -    1  /dev/vg00/lvswap1
reserve       -   19659  -19659
memory    16335    4331   12004   27%
total     40911   23990   16921   59%       -       0    -

Also for pseudo swap (same server) does the below output from glance mean that 4.2gb of physical memory currently is being used as swap? i'm trying to make sense of the output from swapinfo with the glance output to see what actual physical memory is free. (Looking into reallocation memory from this vpar to another)

 

Swap Device                     Type        Avail       Used     Priority
--------------------------------------------------------------------------------
/dev/vg00/lvol2                device      12.0gb        0mb        1
/dev/vg00/lvswap1              device      12.0gb        0mb        1
pseudo-swap                    memory      16.0gb      4.2gb       -1

 

7 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Free physical memory

>mean that 4.2gb of physical memory currently is being used as swap?

 

That's what I read too.  Are you measuring this when the system is loaded?

Laurent Menase
Honored Contributor

Re: Free physical memory

It is pseudo-swap, so it is just a counter of reserved memory -

So it doesn't get 4.2G of your memory, it just mean that the total allocated reserved memory by application is 4.2G

Matti_Kurkela
Honored Contributor

Re: Free physical memory

From the document titled "Memory usage (What is using all of the memory?)" by Eric Herberholz at HP:

-----

The memory line is infamously misleading and does not refer to acual physical memory use!!!! Rather it is the size of pseudoswap, which happens to be calculated to be 75% of the size of RAM (a.k.a. memory.)  As the name ("pseudo") implies, it does NOT exist. Pseudoswap is enabled by default with the kernel parameter swapmem_on(5) set to 1.  Don't worry about this line, just look at the total line for total used and sometimes it's interesting to look at the device PCT USED as an indication of how much swapping has occurred since the box was last rebooted.

-----


And the swapmem_on(5) man page further explains the memory allocation with pseudo-swap:

In previous versions of HP-UX, system configuration required sufficient physical swap space for the maximum possible number of processes on the system. This is because HP-UX reserves swap space for a process when it is created, to ensure that a running process never needs to be killed due to insufficient swap.

This was difficult, however, for systems needing gigabytes of swap space with gigabytes of physical memory, and those with workloads where the entire load would always be in core. This tunable was created to allow system swap space to be less than core  memory. To accomplish this, a portion of physical memory is set aside as 'pseudo-swap' space.

While actual swap space is still available, processes still reserve all the swap they will need at fork or execute time from the physical device or file system swap. Once this swap is completely used, new processes do not reserve swap, and each page which would have been swapped to the physical device or file system is instead locked in memory and counted as part of the pseudo-swap space.

 So, if your vPar has 16 GB of pseudo-swap, it means it probably has (16 GB / 0.75 =) about 21 GB of actual physical RAM assigned to it.

 

You did not specify the version of HP-UX you have. But if you have Glance available, press "m" in Glance to get the Memory Report page. The bottom of the page has three lines that have a lot of memory statistics that should be useful to you. It includes Phys Mem (amount of RAM on the system), and Free Mem (which is what you are looking for).

 

But if Free Mem is near zero, you should also pay attention to the size of the Buffer Cache (or File Cache in 11.31): unless the caches have been restricted, they may claim large chunks of memory that is not otherwise occupied. If memory is needed for applications and there is no free memory available, the OS will by default automatically shrink the caches as required. (Although in at least 11.23 and older, the buffer cache auto-shrinking was so slow that it was better to restrict the cache to a sensible maximum size in the first place.)

 

So, start by figuring a sensible size for buffer/file caches on your system, and then look at the cache + free memory numbers. If there is lots of free memory, you can clearly take some memory away from the vPar; but if there is not much free memory but the caches are excessively large, that is also a sign that you can take away some memory.

Just make sure you leave at least some space for caching, or your disk I/O performance will suffer.

MK
Slaine
Occasional Contributor

Re: Free physical memory

Ok just trying to get my head round this, what i'm after is how to interpret what amount is being used by say system processes, user processes, etc and more importantly what physical memory is free.

 

I may have misunderstood but from the output below from another vpar thats under load, should I be reading it that there is only 497mb free of physical memory. Also 4.0gb is being used apparently by pseudo swap, thats just reserved not actually in use? And is this fixed or dynamic, ie if the system needs more memory will it reduce the pseudo swap used and start swapping to disk.  Apologies but the more I dig the more confused I get!

 

HP-ux version is 11.23

 

# swapinfo -mat
             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev       16336       0   16336    0%       0       -    1  /dev/vg00/lvol2
dev       32924    2210   30714    7%       0       -    0  /dev/vgswap/lvswap
reserve       -   22719  -22719
memory    15537    4121   11416   27%
total     64797   29050   35747   45%       -       0    -



Swap Device                     Type        Avail       Used     Priority
--------------------------------------------------------------------------------
/dev/vg00/lvol2                device      16.0gb        0mb        1
/dev/vgswap/lvswap             device      32.2gb      2.2gb        0
pseudo-swap                    memory      15.2gb      4.0gb       -1




 Glance C.04.70.001             16:45:52     *            ia64    Current  Avg  High
--------------------------------------------------------------------------------
CPU  Util   S   SRU        U                                   | 31%   33%   42%
Disk Util   FF                                                 |  3%    5%   11%
Mem  Util   S            SU                             U      | 97%   97%   97%
Swap Util   U   UR                R                            | 45%   45%   45%
--------------------------------------------------------------------------------
                                 MEMORY REPORT                      Users=    2
Event         Current   Cumulative   Current Rate   **bleep** Rate   High Rate
--------------------------------------------------------------------------------
Page Faults      3629        22385       648.0      928.8      1742.8
Page In           344         1764        61.4       73.1       597.6
Page Out            0            0         0.0        0.0         0.0
KB Paged In     1.3mb        6.9mb       245.7      292.7      1641.6
KB Paged Out      0kb          0kb         0.0        0.0         0.0
Reactivations       0            0         0.0        0.0         0.0
Deactivations       0            0         0.0        0.0         0.0
KB Deactivated    0kb          0kb         0.0        0.0         0.0
VM Reads         1198         5948       213.9      250.9       293.2
VM Writes           0            0         0.0        0.0         0.0
Total VM :  19.1gb   Sys Mem  :   4.2gb   User Mem:   9.7gb   Phys Mem :  16.0gb
Active VM:   9.0gb   Buf Cache:     1mb   Free Mem:   487mb   FileCache:   1.5gb
MemFS Blk Cnt:                0   MemFS Swp Cnt:                0   Page 1 of 1

Dennis Handly
Acclaimed Contributor

Re: Free physical memory

>if your vPar has 16 GB of pseudo-swap, it means it probably has (16 GB / 0.75 =) about 21 GB of actual physical RAM assigned to it.

 

Unfortunately this 75% figure is stale and no longer valid.  I've also heard it's 7/8.

I think on 11.31, the total is closer to the real memory size.

 

>should I be reading it that there is only 497mb free of physical memory.

 

Yes, that's what it says.  Also pseudo-swap memory is 15.2 vs 16 for physical.

 

 >4.0gb is being used apparently by pseudo swap, that's just reserved not actually in use?

 

No, it is always used, never just "reserved".

 

>if the system needs more memory will it reduce the pseudo swap used and start swapping to disk.

 

It will never reduce pseudo swap, unless a process exits or releases memory.  It will increase and if still not enough, just start swapping additional pages to disk.

 

It may reduce pseudo swap if the kernel needs more resident memory?

 

Hmm.  If something was swapped out and was brought back, that can no longer be counted in the used pseudo swap, otherwise it would be counted twice.

Slaine
Occasional Contributor

Re: Free physical memory

So there's 4gb of the memory being used by pseudo, 11.6gb ish being used by the system/apps and only 497mb free of physical memory in the case above?

Dennis Handly
Acclaimed Contributor

Re: Free physical memory

>So there's 4gb of the memory being used by pseudo

 

I would say that's double counting.

Sys Mem:   4.2gb   User Mem:  9.7gb  Free Mem:  487mb   FileCache:  1.5gb

 

This is pretty close to 16 gb,