1827810 Members
2010 Online
109969 Solutions
New Discussion

swapping versus memory

 
SOLVED
Go to solution
Franky Leeuwerck_1
Regular Advisor

swapping versus memory

Hi,

We have an Ingres 2.0 DBMS running on a HP-UX 11.

When running swapinfo I see a lot of memory is used 89%, sometimes 90% .. ?

One could conclude that the memory is well used, but there is also a possibility that the system swaps to disk a lot.

With DBMS running on the system I would like to know if due to swapping there is a loss in performance.

I could allocate less cache memory for avoiding swapping, but less cache means more other disk i/o operations by the DBMS.

This DBMS version does I/O with internally managed IO threads.

Does someone has some guidelines for this problem ? What would be the best approach for getting a good performance.

Regards in advance,
Franky


# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 1024 230 794 22% 0 - 1 /dev/vg00/lvol2
reserve - 794 -794
memory 465 413 52 89%
total 1489 1437 52 97% - 0 -
12 REPLIES 12
Stefan Farrelly
Honored Contributor
Solution

Re: swapping versus memory

The memory line from swapinfo DOES NOT SHOW MEMORY USAGE. It shows how much of memory is locked by processes ineligble for swap.

To accurately see how much free memory you have use glance/gpm, or vmstat. The free line from vmstat shows pages free, multiply it by 4096 to get size in bytes.

The main point to swapinfo is to show device swap usage - in your case set to 1024MB, and 230MB used - which means at some point you have completely run out of memory. swapinfo doesnt update accurately, so all it means is at one point you had 230MB of memory swapped to disk (which cripples performance). Use vmstat or glance/gpm to check the current memory and swap usage.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: swapping versus memory

As for good performance;

Do not allow any swapping to disk at all. This cripples performance, to something like a factor of 100 times worse. So always keep enough free ram to prevent swapping to disk, even if this means reducing other caches (like hpux buffer cache or database caches).

We dont allow any of our production servers to run out of RAM. If you want to increase your cache sizes to improve performance some more simply purchase more RAM - its cheap nowadays.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Franky Leeuwerck_1
Regular Advisor

Re: swapping versus memory

Thanks Stefan for your quick and clear explanation.

In my example, device swapping was 22% used.
What is an acceptable % of device swapping ?

Franky
Jeff Schussele
Honored Contributor

Re: swapping versus memory

Hi Franky,

For optimal performance - zero.
Disks are thousands of times slower than memory.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: swapping versus memory

That's one of those impossible to answer questions, other than "It depends". Even the overall percentage of device swap could be quite high and performance could be still quite good --- IF THE PAGEOUT RATE IS VERY LOW. You really should use Glance or vmstat and examine the pageout rate; if this value is anything above very small values then you are taking a large performance hit. Note that you might actually see some pageout's even if not swapping at all if memory-mapped files are in use.

The rule for most modern boxes is to do no swapping at all because the the performance hits are so big. On the other hand, if swapping only occurs late at night with few users but large batch jobs then you might find that it is perfectly acceptable.
If it ain't broke, I can fix that.
Patrick Wallek
Honored Contributor

Re: swapping versus memory

I quite agree with Jeff. The only real reason to allocate swap space anymore is so each process can allocate a piece of it *just in case* it ever needs it. You do not ever want to actually have to use swap space. Memory is cheap enough that you should add memory before adding swap.

In you case it appears that you are VERY VERY short on memory. I would seriously look at adding more. If you don't want HP memory, you could go with a company like Kingston. I have used them without any problems at all.
Franky Leeuwerck_1
Regular Advisor

Re: swapping versus memory

Thanks all for your inputs.

The point is that extra memory costs money ( esp. the engineer doing it ). Sometimes the current budget doesn't allow anymore hardware upgrades.
The choice I have is either
- sticking to my dbms configuration with almost all the memory allocated for dbms caching, minimizing dbms io, resulting with swapping
or
- lowering the amount of dedicated dbms cache, therefore minimizing swapping, but resulting in more dbms i/o's

What would be the best choice ?

Franky
A. Clay Stephenson
Acclaimed Contributor

Re: swapping versus memory

If you are seeing significant pageout rates (and I think you are) then reduce the database cache sizes. Swapping is much more expensive (by at least two orders of magnitude) than extra trips to the disk for database access. My Plan A would be to look for 3rd-party memory. Kingston is literally a factor of 10 cheaper than HP and I've never had any more problems with it than with HP memory. I even keep a spare module on-hand because it's so cheap.

If it ain't broke, I can fix that.
Franky Leeuwerck_1
Regular Advisor

Re: swapping versus memory

Hi A.Clay,

I only have one daily vmstat output for the last days. This is insufficient information, to base some decision on it.

Anyway they all show 0 for the po column and often numbers below 10 for the pi column.

Suppose this would be the current picture. Does this mean anything, in the context of this discussion.

Franky
Francis_12
Trusted Contributor

Re: swapping versus memory

Hi A. Clay,

Hello,

>My Plan A would be to look for 3rd-party >memory. Kingston is literally a factor of
>10 cheaper than HP and I've never had any
>more problems with it than with HP memory.
>I even keep a spare module on-hand because
>it's so cheap.

The usage of non-HP memory into s700 or s800 boxes is totally unsupported by HP and can lead to sneaky problems during your operations. Most of them are HPMCs, kernel panics or luckily PDTs (Page Deallocation Tables) filled up randomly.

One thing more. There could also be problems during firmware upgrades made by HW engineers on site.

So, if the server is a critical server, i would not recommend your plan A (unless you accept to play with risks).

Sorry, Bye.

Francis DERDEYN - HP-UX ASCE.


Patrick Wallek
Honored Contributor

Re: swapping versus memory

Francis,

No offense intended, but that sounds like a bunch of HP nonsense to discourage use of 3rd party memory. Granted 3rd party memory is not supported by HP. That's why I generally have at least 1 bank of HP memory so all the other can be removed if need be. As to your other points, I have never seen any of that. If that truly were the case the 3rd party manufacturers wouldn't be in business very long.

Until HP does something with its memory pricing I still recommend minimal HP memory and the rest 3rd party. HP is just WAY WAY too pricy with its memory.
Franky Leeuwerck_1
Regular Advisor

Re: swapping versus memory

Hello Francis,

Thanks for your input too.
Let us not start another topic (HP versus non HP RAM) in this thread.

Regards,
Franky