Operating System - HP-UX
1820475 Members
3050 Online
109624 Solutions
New Discussion юеВ

Re: Virtual memory and swap

 
SOLVED
Go to solution
UXisCool
Advisor

Virtual memory and swap

I'm a little confused on the terms virtual memory & swap. When I do swapinfo, I see 8gb of swap & 6gb pseudo swap for a total of 14gb. When I use GPM to check virual memory, I only have 3.4 gb of total virtual memory. My DBA needs more swap for a process than the 3.4 which is hanging things ... why wouldn't there be 14 gb of virual memory to use from instead of 3.4 tops?
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: Virtual memory and swap

Shalom,

Different tools, different calcuations.

swapinfo -tam is going to give you the best measure.

gpm may be showing how much swap is free.

Your dba asking for more swap is an issue here. If your system is paging to disk, adding swap may make it more stable, but won't make it any faster. In fact it will be slower.

The better approach here, not knowing physical memory is probably to add memory.

If you post swapinfo -tam output and vmstat output, I can give a more precise analysis.

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
UXisCool
Advisor

Re: Virtual memory and swap

Here is what swapinfo -tam gave me.

Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 8192 200 7992 2% 0 - 1 /dev/vg00/lvol2
reserve - 2990 -2990
memory 6290 484 5806 8%
total 14482 3674 10808 25% - 0 -

I agree they are different tools but shouldn't vitual memory and swap be closer? We're talking 11 gig difference in what is the most that virtual memory thinks it can obtain. The oracle process is grabbing exactly all of what is virtual memory.
Don Morris_1
Honored Contributor
Solution

Re: Virtual memory and swap

Where is gpm reporting the 3.4Gb? If it is based on just the "Memory Report" section -- Total VM is the total Virtual Memory consumed by all processes (both active and inactive), not the total *possible* Virtual memory.

You are entirely correct that swap space is an indicator of total possible Virtual memory (it isn't exact, however, since file-backed objects are allowed to be virtually mapped without needing additional swap... or in simpler terms, mmap() with MAP_FILE is exempt from this rule, as are most Text sections of binaries, etc.).

When you say that you need more swap and that it is "hanging things" -- can you be more specific? Is a script hanging? The system? Because if the process did actually try to grow virtually, I see no reason from the swapinfo output for it to be failed. You may be hitting other issues like the maxdsiz / maxdsiz_64bit cap, shm* tunable caps, etc. We'd need more information on exactly what's failing (i.e. if it is a system call, which one, at least?) to try to determine that.
Jon M Zellhoefer
Valued Contributor

Re: Virtual memory and swap

I agree with the previous post. If it is a database (oracle or sybase perhaps) that is trying to allocate virtual memory, you should check maxtsiz, maxtsiz_64bit, maxdsiz & maxdsiz_64bit ... it's probably trying to allocate more shared memory then you currently have allowed. More often than not those params and occasionally shmmax will hold up a databse allocating memory more than anything else.
Gokul Chandola
Trusted Contributor

Re: Virtual memory and swap

Here when you run command swapinfo -tam it clearly shows there is more free swap memory available.
Second thing if you want to exact use of your memory online useing you can use "TOP" command to check how many memory currently application or system using. After that you can say you have required more swap space.
My suggetion is that please use "TOP" command to check memory status freqently, after that you may not required Swap space and problem is in with other side.

Regards,
Gokul Chandola
There is always some scope for improvment.
Dennis Handly
Acclaimed Contributor

Re: Virtual memory and swap

>Jon: you should check maxtsiz, maxtsiz_64bit

These don't take up swapspace and you would need a lot of code monkeys to exceed the default values for code size.
SKR_1
Trusted Contributor

Re: Virtual memory and swap

You can increase the physical memory, there is no need to increase the swap space because its already double to the physical memory. When you get more physical memory then you can increase the swap space also.

Thanks

SKR
Jon M Zellhoefer
Valued Contributor

Re: Virtual memory and swap

Dennis -

I didn't say they were related to swap.
Dennis Handly
Acclaimed Contributor

Re: Virtual memory and swap

>Jon: I didn't say they were related to swap.

Ok but the author's question was about swap. I'm also saying you usually never have to check maxtsiz.