1752587 Members
4116 Online
108788 Solutions
New Discussion юеВ

swap memory almost full

 
SOLVED
Go to solution
Kenneth_18
Frequent Advisor

swap memory almost full

When I do a swapinfo I get the following:


kb kb kb pct
TYPE AVAIL USED FREE USED
dev 1048576 957632 90944 91%
reserve - 90944 -90944
memory 372408 351572 20836 94%

As you can see, the swap space is more than 90%.

How can I decrease the swapspace usage without rebooting the machine?

How can I identify any applications or process which caused the swap space to be filled.

Thanks in advance.
8 REPLIES 8
Steven E. Protter
Exalted Contributor
Solution

Re: swap memory almost full

Yes you have a problem.

But swap is reserved, it might not all be in use.

You can decrease swap usage by lowering the load on the machine. Specifically, the number of proccess running.

Every time a process is spawned memory is reserved for it.

If you have an oracle database open but not in use, shut it down, that will help.

The only way to reduce swap usage is to reduce the number of processes open.

You can sit at 90% forever and its not going to hurt that much.

You might want to collect a little performance data. I'm attaching a script that might help with that.

It runs background, puts it output into /tmp and you want to look at the swap information.

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
John Poff
Honored Contributor

Re: swap memory almost full

Hi,

If you have Glance installed, you can use it to see which processes have a lot of memory reserved, and terminate those processes that you can. You could also add some more swap on the fly if you have the disk space, and if you can't find any suitable process candidates to terminate.

JP
Steven E. Protter
Exalted Contributor

Re: swap memory almost full

post this output please

swapinfo -tam

I think I made a mistake, but swap seems three times physical memory already. Increasing swap might slow the box down too much.

Is this box running at a high load factor?

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
Patrick Wallek
Honored Contributor

Re: swap memory almost full

The only real way to decrease your swap usage is to stop some of the programs / processes that are running.

With that much swap being used, your machine is probably performing very poorly.

As suggested, use glance, or some other tool, to determine what programs are using the most memory and stop them.

I would highly suggest that you look into getting some more RAM for this machine. 3rd party RAM is very reasonably priced and works just fine. I have used Kingston and not had any problems.
malay boy
Trusted Contributor

Re: swap memory almost full

The one thing I could think of is create a secondary swap space or increase memory.Swap space are related memory.

If the process cannot find space in memory,the less recently used space from memory are transfered to SWAP space.

So if you have a big usage of swaps mean your memory are very busy and a lot of swapping are done.

I guest the right way is to increase your memory.

regards
mB

There are three person in my team-Me ,myself and I.
Steven E. Protter
Exalted Contributor

Re: swap memory almost full

OT for malay.

In case you are looking.

If you want to learn about webhosting, post a thread. My reply to you was in a doomed thread.

Apologies to owner. Zero points this post please.

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
Bill Hassell
Honored Contributor

Re: swap memory almost full

Using swap space (not just reserving it) is ALWAYS very bad for performance unless most of your programs are idle, perhaps waiting for operator input. If your system seems slow, then you do not have enough memory at all. You have 384megs of RAM which is perhaps adequate for a single user workstation, but only 10% of what you need for a large commercial database program such as Oracle, Informix or Sybase. You can verify how bad the situation is by running vmstat. Look at the "po" column and if it is 2 or 3 digits in size then some of your programs are being slowed, perhaps to about 1% normal speed due to the severe lack of memory.


Bill Hassell, sysadmin
twang
Honored Contributor

Re: swap memory almost full

Short term fixes:
- extend the swap online
- kill the 'problem' process that ocuppying so much swap
- reboot the system

The most important thing is that you should be looking at what is causing the problem.
If it is an application with a memory leak, then fix it. Or you might need some RAM.