LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-08-2010, 08:38 AM   #1
shrodingersadmn
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
What process is using the swap file?


I have a number RHEL 4 64 bit boxes hosting Oracle. The two most heavily populated servers have been having an issue with swap usage. Every night during the backup window (filesystem backup), memory spikes, and the swap file nears 100% usage. The memory lowers, but whatever process is using swap holds on to it. There is nothing in top to indicate what process it is.

There is no issue with the lower used boxes. The two servers in question have 128GB ram, so it's not like the swap is needed for backup processes.

After a reboot, everything goes back to normal. The problem is, the high swap usage causes performance problems, thus requiring a reboot, then there is little to investigate, since nothing is showing in the logs.

Is there any way to determine exactly what process is holding on to swap space? That would at least give a direction to look in.
 
Old 01-08-2010, 09:49 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
1. "top" definitely shows you which processes are consuming the most memory. If you're swapping, then the processes shown in "top" by definition include the processes using "swap".

2. But the best answer to your question is "procfs". For example:
Quote:
cat /proc/1/stat
<= detailed statistics for PID 1
PS:
PID's don't "hold on" to swap. They *can* hold on to memory ... and if there isn't enough RAM in the system, the system will use swap. In other words, the only solution is to a) make the process use less memory, or b) add more RAM to the system.

Last edited by paulsm4; 01-08-2010 at 09:50 AM.
 
Old 01-08-2010, 10:21 AM   #3
shrodingersadmn
LQ Newbie
 
Registered: Jan 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the response. I know nothing is <i>supposed</i> to hold on to swap space, but something is. I'll grab the top output next time it happens. It shows basically 60-some GB of free memory, and swap at 98%. I know it dowsn't make any sense, but there it is...
 
Old 01-08-2010, 10:32 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by shrodingersadmn View Post
Every night during the backup window (filesystem backup), memory spikes, and the swap file nears 100% usage.
I think that is perfectly normal behavior and does not indicate anything that should be corrected.

During backup, the kernel decides that file caching is a more important use of memory than keeping idle pages of tasks that aren't doing anything at that moment.

Because it is a backup operation on a system with a very large amount of ram, the kernel is probably wrong in deciding to do so much file caching. There may be a way to make the backup process make the kernel understand that less file caching is appropriate. But the benefits would be trivial compared to your effort in figuring out how to modify the backup code. I think you should just leave it.

Quote:
The memory lowers, but whatever process is using swap holds on to it.
Because you have so much ram and because the backup operation has finished, the only pages that remain in swap are pages that are not accessed at all by the tasks that own them. Keeping those pages in swap is optimal for system performance.

The only non optimal swapping is the pages that are pushed out by file caching during backup and pulled back in after the backup, and that is only slightly non optimal. Pages that are pushed out and stay out are pages that should stay out.

Quote:
There is nothing in top to indicate what process it is.
I was in another thread recently where someone posted a simple shell command to extract the swap usage from /proc files (and I posted what I think is a modest improvement to that command).

Quote:
it's not like the swap is needed for backup processes.
It's not "needed" but it does slightly benefit the backup process and then the cost of bringing the pages back is tiny. So you have a tiny benefit for a tiny cost. Not something to worry about.

Quote:
After a reboot, everything goes back to normal.
That is a big waste.

Quote:
The problem is, the high swap usage causes performance problems, thus requiring a reboot,
I'm nearly certain you are wrong. The high swap usage does not cause a performance problem and there is no benefit to rebooting.

Quote:
Is there any way to determine exactly what process is holding on to swap space? That would at least give a direction to look in.
Look at that other thread, so you can satisfy your curiosity about this non problem.
http://www.linuxquestions.org/questi...92#post3797292

Last edited by johnsfine; 01-08-2010 at 01:13 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to swap out (to swap area) page frames a process use? entertainyou Linux - Kernel 3 03-23-2011 09:52 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 PM
Which process is using my SWAP ??? b0nd Linux - Newbie 3 01-25-2007 01:10 PM
how to find per-process swap utilization? ananthbv Programming 1 11-02-2006 01:16 AM
Need Help Increasing Swap by creating a swap file froggo Red Hat 3 06-13-2006 08:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:47 AM.

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
Open Source Consulting | Domain Registration