Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Performance impact of Pseudo Swap

Trevor Dyson
Trusted Contributor

Performance impact of Pseudo Swap

Hi Folks,

I have heard and read that enabling Pseduo Swap (swapmem_on kernel parameter) degrades system performance. Some documentation I have seen recommend to turmn it off for optimal performance.

I know what Pseudo Swap does and its impact on lockable memory but I do not know how it might impact or degrades performance if it is turned on.

Can any of you HP-UX performance specialists out there let me know your thoughts on this.

Thanks,

Trevor
I've got a little black book with me poems in
13 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Performance impact of Pseudo Swap

Hi Trevor:

Pseudo swap allows more processes to run than swap devices can accomodate. Pseudo swap space does not exist in reality, rather, arming it only inflates the calculation of device and file swap space.

Beginning with HP-UX 10.0 memory management algorithms were rewritten. Instead of "swapping" in and out whole processes, pages (4K) of a process are now "paged" in and out as necessary. Thus, when whole processes had to be moved in and out of memory, one could argue that declaring pseudo swap would allow more processes to run but at the expense of large amounts of I/O.

With paging occuring in much smaller granules, and only after inuse memory has "aged", it is probable that memory can be found for a new process (or to resume an already running one) with significantly less I/O expense than whole process swapping.

Given a system with an adequate memory configuration, "swapping" (or "paging" as is really should be called) should be very low in the first place, and the issue mote.

...JRF...
Trevor Dyson
Trusted Contributor

Re: Performance impact of Pseudo Swap

Thanks for your reply James but as I said, I do know what Pseudo Swap is used for and to add to that I have a detailed knowledge of Virtual Memory management under HP-UX.

I guess I can make the question more specific as follows

On a system with sufficient RAM to ensure that no paging to/from swap is occuring, does enabling pseudo swap degrade system performance in any way. If so then why.
I've got a little black book with me poems in
Magdi KAMAL
Respected Contributor

Re: Performance impact of Pseudo Swap

Hi Trevor,

pseudo-swap is a powerfull feature if you need it, and a worest one if you don't need it.

If pseudo-swap is on that's means, your dbc_max_pct " Dynamic buffer cache max percentage " kernel parameter will be taken into account :

hp-ux will anticipate reading data from disk into memory to make it available to process, this process allow process to be almost running and to avoid the state "w" which is waiting for I/Os. But if you do not use these data in the memory that means that your are reading disk, allocating memory for nothing.

Attention : by default the dbc_max_pct is set to 50 % of the entire memory -> So, each time you are reading and allocating 50 % of memory for nothing.

Conclusion :
It's a good think if you handle huge flat files and a bad one if you handle a database.

Magdi
Rita C Workman
Honored Contributor

Re: Performance impact of Pseudo Swap

Well since the other guys were technical, I guess I can talk strictly in non-tech-eze.
First I only set up device swap as (non-tech talk here) a last resort for my systems to swap to, but I don't want them to use it...it's just there as last resort and dump space to me.
I tend to turn pseudo_swap ON. Why? Because I want my system to process in memory - it's faster! So I guess to those folks who say turn it off...I would say ....why? Why would you allow your system to fall back to the degradation of device I/O when you could run faster and more efficiently in memory. That is why you buy more memory....to run everything faster. So why would you circumvent the system's ability to run the jobs in memory by turning pseudo_swap off....?
Does pseudo_swap degrade the system? I feel it doesn't-it simply makes the system WORK to it's peak performance. Why have memory, if your not going to make it work for you?
I love illustrations...it's like wanting eggs for breakfast..you go out and buy the eggs, you put them in a pan...but you never let them cook. Turn it on and let your system start doing the cookin'..

Just my thoughts,
Rita

Carsten Krege
Honored Contributor

Re: Performance impact of Pseudo Swap

James is right and deserved more points. :) Magdi, I believe you mix up buffer cache with pseudo swap.

Pseudo swap has no negative performance impact.

Pseudo swap has been invented for a simple reason. On systems with sufficient memory it is not really necessary to reserve swap space for every process, as it is pretty unlikely that we ever start paging. And when we don't need to page, why should we reserve the space needed for it?? With the pseudo swap parameter enabled we are simply NOT reserving swap space for a process as long as the memory utilization is below 75%. You see that we really do less than before. Enabling pseudo swap pretty much behaves as if you have added a swap device with a capacity of 75% of your physical memory.


If more than 75% memory is used, we use the normal algorithm again and reserve swap space for every new process, as it now becomes more likely that we need to page out processes.

For the vast majority of systems it makes sense to enable pseudo swap.

Carsten

-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
Trevor Dyson
Trusted Contributor

Re: Performance impact of Pseudo Swap

Well yes Carsten, James' answer was correct, but it did not answer the original intent of my question, I should have thought a bit more about it before posting. Don't get me wrong, I am grateful for any answers but I am also following the guidelines laid out by HP for awarding points.

I have reviewed again the document that prompted me to ask the question. The document states that if device swap is at least equal to physical memory and that all of physical memory is never likely to be completely used then to disable pseudo swap as it causes additional system overhead even if virtual memory paging never occurs (ie available memory never drops below the desfree kernel parameter). Unfortunately due to non-disclosure agreement I can not disclose further content or the origin of the document.

Thanks everyone for your advice, I will try to be clearer when asking questions in future.

-Trevor

I've got a little black book with me poems in
Carsten Krege
Honored Contributor

Re: Performance impact of Pseudo Swap

I forgot to add the pointer to the memory management white paper. See

/usr/share/doc/mem_mgt.txt

and search for "Pseudo-Swap Space".

Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
Stefan Farrelly
Honored Contributor

Re: Performance impact of Pseudo Swap


The performance impact of Pseudo swap can only happen if you actually run out of device swap. So if device swap is < 100% reserved then it has no impact at all.

If you, for example, have device swap of 1GB and RAM=1GB and your using the entire 1 GB of RAM (no free mem) then pseudo swap can now be used and its performance impact would be very heavy due to > 1GB of programs trying to use only 1 GB of RAM.

Pseudo-swap is only really a safety net. If it was off and you run of device swap then programs will die not being able to allocate space, whereas if pseudo-swap was on at least they would run - albeit slowly and at the cost of your server slowing down a bit.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Trevor Dyson
Trusted Contributor

Re: Performance impact of Pseudo Swap

Thanks everyone for your input.

Carsten's post comes closest to answering my question in his reply:

"Pseudo swap has no negative performance impact."

..although this statement contradicts the document I have seen.

Please do not post any further explanations of how pseudo swap/virtual memory paging works as I already have intimate knowledge of this (including the memory management white paper).

I will drop this until I can speak with someone who has knowledge of how pseudo swap is handled internally within the kernel.

I appreciate the effort everyone has put into providing answers but please consider the thread closed.

Regards,

Trevor



I've got a little black book with me poems in
James R. Ferguson
Acclaimed Contributor

Re: Performance impact of Pseudo Swap

Hi (again) Trevor:

Your comment that "Unfortunately due to non-disclosure agreement I can not disclose further content or the origin of the document" certainly piques my academic interest.

I sincerely hope that you will seek release of this information, and will repost more of the document and/or any ensuing discussion you may have "with someone who has knowledge of how pseudo swap is handled internally within the kernel."

Not to do this, leaves this thread quite open in my opinion.

With my regards!

...JRF...
Trevor Dyson
Trusted Contributor

Re: Performance impact of Pseudo Swap

Hi James,

The rest of the document in question adds nothing to this particular discussion so you are not missing out on anything there.

Rest assured that if I find out any further information that either proves or disproves that pseudo swap negatively impacts performance (assuming that paging is not occuring) then I will share this information.

I have given you a few more points to make up for my meanness earlier on ;-)

I have just noticed that this has been posted into the database forum when I intended it to go to general - oops!.
I've got a little black book with me poems in
Carsten Krege
Honored Contributor

Re: Performance impact of Pseudo Swap

James, this buged me, too. :)

I searched the HP intranet and found an HP internal performance cookbook where it says:

"swapmem_on

This trick to enable pseudo swap is used to increase the amount of reservable virtual memory. It's only useful when you can?t configure as much swap as you need . For example, say you have more phyical memory installed than you have disk available to use as swap: in this case if ppseudo swap is not turned on, you?ll never be able to use all the memory you have installed. The problem is, managing pseudo-swap takes up some memory itself, and can slow performance! We recommend you set this to 0 unless you have a boatload of memory and not enough disk available for allocating to swap."


In my opinion the statement that pseudo swap can "slow performance" refers exactly to the scenario that Stefan describes above. Since the priority of device swap is higher than of pseudo swap, a system that has been configured in a sensible way should never run into such a situation, where device and filesystem swap is exhausted and (pseudo swapped) pages have to be locked in memory.

Of course pseudo swap uses also some memory, but I'm very sure that this is neglectable for large memory systems where pseudo swap becomes really interesting.

Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
James R. Ferguson
Acclaimed Contributor

Re: Performance impact of Pseudo Swap

Hi Carsten:

GREAT! Thank you for your tenacity. That is a grand contribution from you. As usual, you are most helpful and insightful!

Trevor, thanks too! I think you should put the rabbit next to Carsten's last post to flag this thread as having some excellent information.

With my regards, Jim.

...JRF...