Operating System - HP-UX
1757106 Members
1832 Online
108858 Solutions
New Discussion юеВ

How to check which processes use a lot of swap

 
Sabrina Lautier
Advisor

How to check which processes use a lot of swap

I've got a basic Unix question but cannot find a real answer.
My HP-UX 11.11 is out of swap (usage > 98%) and users cannot work on it anymore.
How to determine which processes are the most swap greedy ?
I used gpm (glance plus) but can't find a way to sort the processes by virtual memory usage.
Thanks in advance for your help.
Sabrina
2 REPLIES 2
Sridhar Bhaskarla
Honored Contributor

Re: How to check which processes use a lot of swap

Hi Sabrina,

There are two types of usages account for swap utilization. 1) Reservation 2) Pageouts.

Whenever a process comes up, system ensures that there is enough swap available in case if the pages are to be paged out. That is reservation.

When there is memory pressure, system will move the most idle memory pages onto swap before it brings up new processes. Those are paged out pages.

"UNIX95= ps -e -o 'vsz pid args' |sort -n" will give you top most processes based on their size. That way you can find out which processes have more reservation on swap.


-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: How to check which processes use a lot of swap

All processes reserve swap so they can be swapped out of memory when they are inactive.

The problem you are having is your system is spending a lot of time swapping processes in and out of memory.

A quick look at top or glance or sar output will tell you which processes are being swapped. That display will change a lot. Figuring out which processes are using swap will accomplish very little.

You either need to add swap, or increase system memory. To relieve the short term problem go ahead and increase swap so at least swap can be reserved.

You will take a performance hit, but at least the users won't complain they can't get on because the new process can't reserve swap.

Then plan and execute a memory upgrade. Thats whats really going to deal with the issue. An ideal system is one that reserves swap but never actually has to swap a process to disk.

No paging is an acceptable amount of paging.

The answer to your origina question is the swap greedy processes are the ones being swapped the most. You'll see them on top and then they'll disappear. Then they'll come again.

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