Operating System - HP-UX
1832505 Members
4975 Online
110043 Solutions
New Discussion

Your favorite SWAP Question

 
Q4you
Regular Advisor

Your favorite SWAP Question

On one our systems we have 20G swap mirrored and with proprity set as follows :

lvol2 8 G Priority : 0
lv_swap1 12 G Priority : 1

If system starts swapping, which will be used first ?

Is there any program or method or utility by which I can bring the system to its knees and start swapping heavy say upto 60 to 80% ??

5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: Your favorite SWAP Question

Hi:

The lowest priority (0-10) device (here, 'lvol2') is used first. Device swap is also given preference over filesystem swap. Use 'swapinfo -tam' to monitor swap utilization.

Regards!

...JRF...
Q4you
Regular Advisor

Re: Your favorite SWAP Question

Thanks James,

I am not looking for "swapinfo" to monitor swap space..I am looking for soemthing by which I can surely "cause" heavy swapping temporarily.
James R. Ferguson
Acclaimed Contributor

Re: Your favorite SWAP Question

Hi (again):

I suppose you could write a small C program that does 'malloc()' calls to consume memory.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: Your favorite SWAP Question

All priority 0 will be used first; then all 1's ; then 2's .... If devices share an equal priority, swap will be interleaved among them.

All you need to do to get the machine swapping is to launch many processes - assuming nproc/maxuprc is large enough so that you don't hit that limit first. Something as simple as:

#!/usr/bin/sh

I=1
while [[ ${I} -lt 1000 ]]
do
sh &
I=$((${I} + 1))
done

A few of these should bring any box to its knees.

If it ain't broke, I can fix that.
Shannon Petry
Honored Contributor

Re: Your favorite SWAP Question

Just wanted to add that interleaving does NOT occur if all swap priorities are 0, only 1+. If you set all priorities to 0, swap will use a top down approach to filling/using swap.

Regards,
Shannon
Microsoft. When do you want a virus today?