1833758 Members
2426 Online
110063 Solutions
New Discussion

Swap Tuning

 
Rafael Mendonça Braga
Regular Advisor

Swap Tuning

Hello guys...

I have an 9000/800/rp7410 server with HP-UX 11i. This server has 4Gb of Physical Memory.

I want to check if my swap configuration is good or not to my server. I have heard that the "ideal" swap area has to be 2 times greater than the physical memory in a server without database. If database like oracle is installed on the server, the swap has to be 3 times greater than the physical memory.

My swapinfo:

root@draco$ swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 1579 2517 39% 0 - 1 /dev/vg00/lvol2
reserve - 2354 -2354
memory 3049 1896 1153 62%
total 7145 5829 1316 82% - 0 -



root@draco$ kmtune | grep swap
allocate_fs_swapmap 0 - 0
dmp_swapdev_is_vol 0 - 0
maxswapchunks 16384 - 16384
nswapdev 10 - 10
nswapfs 10 - 10
remote_nfs_swap 1 - 1
swapmem_on 1 - 1


root@draco$ kmtune -l -q dbc_max_pct
Parameter: dbc_max_pct
Current: 40
Planned: 40
Default: 50
Minimum: -
Module: -
Version: -
Dynamic: No



Do you can help me to determine if these are good parameters or not?

Tks,

Rafael M. Braga
7 REPLIES 7
Don Morris_1
Honored Contributor

Re: Swap Tuning

I think your server performance would be better served by adding memory (you're actually paging out 1.54Gb of data (USED for dev swap on lvol2), which means that your system is more likely to be busy doing I/O for page faults than real work... unless of course that 1.54Gb is for processes you don't care about..).

If you can add memory (at least 2Gb to cover what you already know you need, another 4Gb wouldn't be a bad idea [rp7410 can go up to 8 on a single cell board, 16 if you have two boards if I read the spec correctly, so you should be able to manage 8Gb]) then you can monitor your virtual address space consumption (swap reservation: dev + pseudo-swap) to see if you need to add more swap to manage your workload. If you do, your tunables will allow up to 32Gb of device/FS swap without reconfiguration. (Which is good).

All that aside -- the next time you reconfigure the kernel, I would disable remote_nfs_swap. You aren't really using it (since you have only device swap) anyway - but NFS swapping is not a good idea.
Fred.Wu
Frequent Advisor

Re: Swap Tuning

Hi:
Try to tune the swap space from 4gb to 8gb, that means add another 4gb as swap space.

and the dbc_max_pct kernel parameter is not necessary to be so large, 10 is enough for most applications. Too many buffer cache used by file system may cause performance lack.
fred
Bill Hassell
Honored Contributor

Re: Swap Tuning

It is very important to understand that swapping (more accurately, paging) is a very bad thing for performance. You trade performance for memory but the penalty is very high. If your customers are not concerned about rapid response (many seconds to minutes for a response) then swap is fine. If you don't use all of your swap space, then all the programs will run. Note that swap space is actually used when there is not enough RAM and this is when paging will dramatically slow down performaqnce (10x to 100x slower).

But swap space is also reserved even though it is not used. In this case, you need enough swap space to cover all processes that may be in RAM at the same time, or less depending on the kernel parameter swapmem_on. When this parameter is 0, then the minimum swap is 1xRAM. If you need to run more processes at the same time, then increase as needed. There is NO valid rule about 2xRAM for swap space. It all depends on swapmem_on and what your processes actually require. Now if you change swapmem_on to 1 (the default), then you can reduce your swap space by as much as 75% of RAM.

Leave the default setting sxwapmem_on=1 and change your dbc_max_pct to 8 to 10. 4Gb of RAM is a good starting point but your swapinfo command shows 40% usage...not goo for performance at all. If you add an additional 4Gb of RAM, swapping should stop and performance should improve significantly.


Bill Hassell, sysadmin
Rafael Mendonça Braga
Regular Advisor

Re: Swap Tuning

Hello guys... Tks for the tips 'till now...

Let try to explain wht I'm trying to tune it...

This server I took as an example, but I have several servers here in the company with a performance monitor installed that are reporting me "Virtual Memory Usage is at 95%".

I think is not a good thing all right?

So I put this server as an example... I would like to know what parameters I have to set to reduce the Virtual Memory Usage...

tks,

Rafael M. Braga
Bill Hassell
Honored Contributor

Re: Swap Tuning

Virtual memory usage is what all programs use. It is real RAM when there is enough room and swap space when all the prgrams won't fit into RAM. You reduce virtual memory usage by stopping the big programs. Now that is usually not an option so you ask the developers or the application manufacturer how to make the programs smaller. This usually results in heavy performance penalties.

In otherr words, 95% virtual memory usage means that your machines are severely undersized for RAM. If you double the amount of RAM, the issues all disappear. I know, RAM is expensive but the alternative means reconfiguring programs to run smaller (if possible) and this means performance issues. You already have paging taking place based on swapinfo which in itself is a performance hit. There is no other fix. Run slow or add RAM.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: Swap Tuning

The best way to tune swapping is to make surre it never happens.

The summary of what I've seen so far indicates the need to get mor ememory.

I think the dbc_max_pct should be scaled back to within a few numbers of dbc_min_pct

That wastes a lot of memory and is very hard on the system when the actual value is being changed.

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
Ted Buis
Honored Contributor

Re: Swap Tuning

You are likely to improve performance by reducting max_dbc_pct as stated by others. Also, you may want to consider OnLineJFS which gives you additional mount options to avoid double buffering data in both Oracle and in the buffer cache. See the attached.
Mom 6