LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-04-2010, 05:11 PM   #1
rhel5
Member
 
Registered: Mar 2009
Location: Bay Area, CA
Distribution: Redhat Enterprise Linux
Posts: 59

Rep: Reputation: 15
Please Help - High Swap Use with High RAM available


I did google search but couldn't find a good explanation on why would a system use up the swap memory when there is plenty of physical memory (RAM) available. PLUS, there are no appplication running that require memory usage.

Basically, a machine that is idling and is using up all of the swap space.

My impression is that linux will start using swap when physical memory runs low.

Can someone please help me explain why and how I can find out what processes are using up the swap?

Here is the top output:

top - 13:12:20 up 14 days, 2:30, 60 users, load average: 2.48, 2.32, 2.20
Tasks: 561 total, 3 running, 528 sleeping, 12 stopped, 18 zombie
Cpu(s): 12.5%us, 0.1%sy, 0.0%ni, 87.4%id, 0.0%wa, 0.0%hi, 0.0%si,0.0%st
Mem: 66006556k total, 40495008k used, 25511548k free, 14260k buffers
Swap: 83883388k total, 83775112k used, 108276k free, 380004k cached
 
Old 05-04-2010, 05:17 PM   #2
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
The memory also has to hold cache (which will go away when swap starts getting used) and buffers. Top doesn't show this information. Also, it looks like you had a process eating a lot of memory that ended properly. I would install sar possibly set up a cron job to record stats and when the swap starts getting hit again checkout what process is using the most memory.

Swap doesn't get hit unless processes are requesting that memory and it's not available.

Regards,

Alunduil
 
Old 05-04-2010, 05:27 PM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
Quote:
Originally Posted by rhel5 View Post
why would a system use up the swap memory when there is plenty of physical memory (RAM) available.
It looks like a lot of physical ram, but given how much is in use, it certainly doesn't look like "plenty".

Quote:
there are no appplication running that require memory usage.
What do you mean by "running". It certainly looks like the 528 tasks sleeping and/or 12 stopped and/or 18 zombie are using an absurdly large amount of "memory".

Linux has properly flushed as much of that idle memory use as possible out to the swap area, but it appears that it didn't all fit in the swap area, so anonymous memory of stalled tasks is clogging physical ram as well.

Quote:
My impression is that linux will start using swap when physical memory runs low.
Too simplistic a view.

Quote:
Can someone please help me explain why and how I can find out what processes are using up the swap?
You want to know which task(s) is/are using absurdly large amount of anonymous memory.

I don't know any great way to do that.

The VIRT size of a task (as shown by top) is typically far larger than the task's anonymous memory use. So you may find tasks with absurdly large VIRT values that aren't using much anonymous memory. But the anonymous memory can't be larger than VIRT. So the problem task(s) should be among those with very high value for VIRT (you can tell top to sort those to the top).

Try to figure out why the VIRT value is so high for each task that has it high. Some might not be significant amounts of anonymous memory. But hopefully you can find the problem tasks.

Quote:
Originally Posted by alunduil View Post
it looks like you had a process eating a lot of memory that ended properly.
I agree, the system looks like fairly little has happened since some process eating a lot of memory ended. But I would bet against "ended properly". The swap area is nearly full and the cache is nearly empty and there is 25GB of free ram. The only easy way to get to such an extreme is for the system to hit an "out of memory" condition and then the out of memory killer killed a monster task that was using over 25GB. The "ended properly" theory implies the system came within a hair of triggering the out of memory killer and then a monster task happened to end properly just in time.

That left somewhere between 83GB and 124GB of anonymous memory still in use. So I think that monster still has a sibling sitting around.

Last edited by johnsfine; 05-04-2010 at 05:41 PM.
 
Old 05-05-2010, 12:41 PM   #4
no2498
Member
 
Registered: Jan 2010
Posts: 120

Rep: Reputation: 23
top - 13:12:20 up 14 days, 2:30, 60 users, load average: 2.48, 2.32, 2.20


60 users looks odd to me
 
Old 05-05-2010, 07:02 PM   #5
alunduil
Member
 
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684

Rep: Reputation: 62
What's the output of 'w'?

Regards,

Alunduil
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Apache] High Swap Usage IPAddress Linux - Server 5 10-19-2009 07:24 AM
High load, high RAM usage and unresponsive VPS saeed22 Linux - Server 1 08-20-2009 12:58 PM
High RAM usage! Cyhaxor Linux - Hardware 2 10-29-2007 11:32 AM
High Swap Memory Usage rickylim Solaris / OpenSolaris 3 07-02-2006 06:27 PM
High Swap and Memory Usage rickylim Solaris / OpenSolaris 4 05-04-2006 09:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration