LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-20-2012, 08:17 AM   #1
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Rep: Reputation: 16
Swap memory treshold - warning - critical


hi guys

the monitoring team is using a tool for monitoring linux boxes and they set an alarm for swap memory to 10%(critical) I really has no idea when swap memory usage is high....

Can someone recommend me a threshold for this? when is warning or critical and this parameters can affect performance in my Suse Linux boxes?

for instance 1 box has been having "peaks" of 14% during last days....they don't know if the box has issues but they see the alarms and today another box had a peak of 64% and they are worried should they? basically they told me these 2 boxes should not have peaks like that they should be 0% swap usage....so how they say that

thanks a lot

Last edited by kopper27; 03-20-2012 at 08:19 AM.
 
Old 03-20-2012, 08:42 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
swap utilization size all by itself doesn't mean that much. swap and physical memory combine to create virtual memory. Applications preallocate address space at start up and by having more virtual memory you can start more things than you could if limited to physical memory.

What you need to know is pageins/pageouts. This is what tells you not just if swap space is being utilized but whether in fact you are "paging" (swap is an old term still used but modern *NIX does paging rather than swapping). If you have a high number of pageouts AND pageins it means that the system is memory constrained so is having to push parts of active processes out to swap and then call them in. Since this reduces memory calls to disk speed it impacts performance.

You can see pageins and pageouts with vmstat (si and so columns).
vmstat 5 5

Also if you have sar installed and running you can get hourly statistics with "sar -B".

It is retarded to say swap should always be 0. If that were the case you wouldn't need to configure swap in the first place.
 
1 members found this post helpful.
Old 03-20-2012, 08:48 AM   #3
kopper27
Member
 
Registered: Nov 2009
Posts: 147

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by MensaWater View Post
swap utilization size all by itself doesn't mean that much. swap and physical memory combine to create virtual memory. Applications preallocate address space at start up and by having more virtual memory you can start more things than you could if limited to physical memory.

What you need to know is pageins/pageouts. This is what tells you not just if swap space is being utilized but whether in fact you are "paging" (swap is an old term still used but modern *NIX does paging rather than swapping). If you have a high number of pageouts AND pageins it means that the system is memory constrained so is having to push parts of active processes out to swap and then call them in. Since this reduces memory calls to disk speed it impacts performance.

You can see pageins and pageouts with vmstat (si and so columns).
vmstat 5 5

Also if you have sar installed and running you can get hourly statistics with "sar -B".

It is retarded to say swap should always be 0. If that were the case you wouldn't need to configure swap in the first place.

thanks a lot for this great info
and I agree with you about no swap utilization


by the way what when I know pages in and pages out are high so I can say my server is memory constraint

Last edited by kopper27; 03-20-2012 at 08:53 AM.
 
Old 03-20-2012, 08:59 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Are these real or virtual systems? Memory management in a virtual machine may be strange and is certainly specific to the type of virtualization.

Quote:
Originally Posted by kopper27 View Post
they set an alarm for swap memory to 10%(critical) I really has no idea when swap memory usage is high....
You mean 10% swap used and 90% swap free, not the other way around, correct?

Quote:
Can someone recommend me a threshold for this? when is warning or critical and this parameters can affect performance in my Suse Linux boxes?
Without knowing a lot more, we can't say what % would be a problem. For a workstation or small server I think 2GB of free swap is an appropriate margin. For a larger server, you should have a little more than that.

How much swap space and how much ram do these systems have? That info would give a little perspective on the % values you reported.
Quote:
for instance 1 box has been having "peaks" of 14% during last days....
If you have 2GB of swap and 14% is used, you probably should fix something. If you have 4GB of swap and 14% is used, there is less likely any need to correct anything.

Quote:
today another box had a peak of 64% and they are worried should they?
64% swap use sounds like a problem. If your system had unusually high swap usage for a well understood reason and someone had set the swap size to a safe margin above that, it could have 64% swap usage and be perfectly correct and safe. But that doesn't sound like your situation. Either the swap allocation is low so a reasonable use of swap space fills 64% (meaning you ought to have much more swap allocation) or you have an unexpected large use of swap space that you should examine.

Quote:
they told me these 2 boxes should not have peaks like that they should be 0% swap usage....so how they say that
0% swap usage is a foolish target. Servers should use some swap space. But servers should also have a generous margin of free swap space.

If you can run free at a moment when swap usage is "high", you can get a better idea of the overall memory state.

If the used swap reported by free is lower than cached ram reported by free, you have moderate to low swap usage. Under those conditions, I think 2GB of free swap space is a pretty safe margin.

If the used swap is greater than the cached ram, you should be worrying about both the swap in/out rates for whether the system has enough ram to do its job and the out of memory killer (whether the system has enough swap space for safe operation). In such a system, I do not think 2GB of free swap is enough of a safety margin.

Last edited by johnsfine; 03-20-2012 at 09:22 AM.
 
1 members found this post helpful.
Old 03-20-2012, 06:28 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
In addition to MensaWater's advice, you might also look at iostat http://linux.die.net/man/1/iostat.

If the alert system is currently warning you, that's good (in as much as its doing its job), but I'd also recommend graphing swap usage values regularly so that you can see the history.
This will help you pin down which process(es) is/are causing the issue.

For example we currently use Nagios for alerting & Cacti for historical graphing/tending.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nagios - warning and critical alerts to different email address sp149 Linux - Newbie 1 12-18-2009 12:52 PM
FC8 on laptop: no warning for critical battery? xpucto Fedora 2 11-29-2007 08:02 AM
Nagios2: Inaccurate harddisk warning/critical status reporting Akhran Linux - Software 0 08-13-2006 06:11 PM
Yamipod. Gtk-CRITICAL, Gdk-WARNING. How to resolve? lebabyg Linux - Software 2 04-01-2006 06:50 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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