LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-01-2009, 12:50 AM   #1
mohitanchlia
Member
 
Registered: Aug 2008
Posts: 60

Rep: Reputation: 15
Swap space


I am seeing that linux OS almost hangs and becomes very slow. It looks like it's because of swapping. But how can I tell if swap space is the reason for slowness? CPU looks ok and memory too. We have Oracle running on that box and out of 16G we have given 12G to Oracle. I am using sar -r 2 2000 and I see 10% of swap used. Could that cause slowness? How do I debug it more? How can I tell which process is swapping or if swapping is issue.

Another question, even if we are swapping why would OS slows down? As if it's hanging.
 
Old 08-01-2009, 04:13 AM   #2
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by mohitanchlia View Post
I am using sar -r 2 2000 and I see 10% of swap used. Could that cause slowness?
I am not sure that -r tells you what you want to know at this point for this kind of problem. It tells you about the memory usage, but what you want to know first is about disk traffic and probably how much of the traffic is due to swapping.

Once you have confirmed that there is an excessive level of traffic (or not), you'll want to know whether this is swapping or other traffic, and then you will want to know which process or processes are causing it. You need to work through the steps, rather than just jumping to a point close to the end of the process.

Remember, just having some swap space in use doesn't slow the machine down, data traffic to and from the disk does.

Quote:
Another question, even if we are swapping why would OS slows down? As if it's hanging.
Use of a hard disk is orders of magnitude (say 1000 times, depending on what exactly you measure) slower than use of RAM. Anytime you slow the computer down by a factor of a 1000 (in provisioning your computer, you may have become excited about the prospect of getting a machine with a 10% higher clock speed...imagine replacing your GHz processor with one of the same number of MHz, just as a thought experiment) you will notice it.

When an OS swaps, it wants a page that is not currently in memory. It tries to get that page from swap or otherwise from the hard disk, but it has no free pages into which to put that information. A page must be cleared from memory to make room. If that page is to go to swap, that is a slow operation and getting the information from hard disk is a slow operation, and, in the worst case, by the time all of the shuffling of memory pages has taken place, it will already be time to process another page from a different task, and that page won't be in main memory... And so it goes.
 
Old 08-02-2009, 11:49 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,606

Rep: Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445Reputation: 2445
Try running 'top' and check the values when it slows down. Generally, 10% of swap is nothing to worry about.
 
  


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
how to reduce swap space and reclaim the space grantm Linux - Newbie 7 08-16-2012 07:05 AM
swap file or swap space? simonb1975uk Linux - General 11 08-15-2008 02:39 PM
swap space (or) swap file yusufs Linux - Newbie 8 07-17-2008 02:02 AM
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM

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

All times are GMT -5. The time now is 05:17 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