1830410 Members
2524 Online
110002 Solutions
New Discussion

pseudo swap, again

 
SOLVED
Go to solution
Mihai Matei
Advisor

pseudo swap, again

Hi,

1. On systems with device swap < physical memory, pseudo swap should be enabled always, or the physical memory can't be fully used.

2.On systems that have device swap = 1 * physical memory, should pseudo swap be disabled, because of the (small) overhead? Or should it be left enabled, to cater for the possibility that the system runs low on memory and will need to use the device swap space for 'real' paging?

2. What about when device swap > 2*physical memory? It's my understanding that pseudo swap in this case would not be of any use, because there is enough swap space to 'reserve' and to pageout in case the system runs low on memory.
8 REPLIES 8
Hai Nguyen_1
Honored Contributor

Re: pseudo swap, again

Mihai,

I believe that we are encouraged to leave pseudo swap on (by default). The order of swap usage is pseudo swap then device swap and then (last) filesystem swap. Needless to say, swapping things from pseudo swap is faster than the other two since data is on the RAM, not on a harddisk.

Hai
Mihai Matei
Advisor

Re: pseudo swap, again

My understanding is that pseudo swap is just a number added to the device swap space size to give you the swap_avail. swap_avail gets decreased every time a process is run, with the amount of reserved swap space, so it's not a question of pseudo-swap being faster than device swap, but more a question of what size the real swap is in relation to the physical memory.
Hai Nguyen_1
Honored Contributor

Re: pseudo swap, again

Mihai,

In practice, the real swap needs to be at least the size of the RAM in order for the OS to be able to reserve swap space for every process spawn. This practical rule can be ignored if you have lots of RAM and a handful of little processes (not requiring much RAM).

Hai
Stefan Farrelly
Honored Contributor
Solution

Re: pseudo swap, again

1. Yes. If you are so desperately short of disk you cant set it to at least 1x Physical RAM then pseudo swap must be on - even then you will not be able to use all of RAM because you are wasting RAM as swap when you should be using disk.

2. & 3. Yes, pseudo swap should always be on - its a safety net. Just in case you use all your device swap then it will use RAM as swap which may save you from your application crashing. eg. you lose an unmirrored disk with device swap on - pseudo swap will save you!

We always have pesudo swap on all our servers.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Mihai Matei
Advisor

Re: pseudo swap, again

Interesting idea about losing an unmirrored swap device disk... I haven't thought of that.

But I'm not sure I understand how is RAM wasted when pseudo swap is used, if it's only added to a counter of remaining swap space... nothing is actually paged-out to pseudo swap, is it?
James R. Ferguson
Acclaimed Contributor

Re: pseudo swap, again

Hi:

Pseudoswap is for reservation only. A good discussion can be found in the Technical Knowledge Base document #KBRC00010136

Regards!

...JRF...
Stefan Farrelly
Honored Contributor

Re: pseudo swap, again


Lets imagine you have 1GB of RAM and 1GB of device swap. You load 1GB of programs into memory (just for this exercise lets presume theyre all unlocked so eligble for paging/swapping). To load 1GB of programs into memory 1GB of device swap must be reserved - which means all 1GB of device swap is now allocated. None free.

Now, you load another program of 100MB. There is no RAM left, so 100MB of programs are paged out to device swap, freeing up our 100MB of RAM to load our new program. However, this new program must also reserve 100MB of device swap - and there is none left! (if you didnt have pseudo swap on your program load would fail at this point) so with pseudo swap it will now reserve 100MB of memory - meaning another 100MB must be paged out to device swap. This means loading this 100MB of program has caused 200MB of programs to be paged to device swap (double the size of our 100MB program).

If you had 2GB of device swap then loading this 100MB program would still swap/page 100MB of programs to device swap to free up RAM to load it, but it would reserve 100MB of swap on disk (instead of RAM via pseudo swap), which is much more efficient.

So can you now see how pseudo swap would save you ? but its no substitue for having more device swap. Thats why HP recommend having device swap > RAM.

But remember, for performance reasons you never want RAM to get to 0! You always want to keep some RAM free. This is what we do, so we only set device swap = ram, because we never intend to let our servers run out of ram or else their performance will become crap. But we leave pseudo swap, just in case!

Im from Palmerston North, New Zealand, but somehow ended up in London...
John Bolene
Honored Contributor

Re: pseudo swap, again

always turn on that pseudo swap, it makes problems go away
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com