
05-18-2006, 02:53 PM
|
|
Web Hosting Master
|
|
Join Date: May 2002
Location: Raleigh, NC
Posts: 605
|
|
Generally on Linux servers, I see physical memory usage high, which is normal as Linux likes to reserve extra memory.
I'm perplexed, this server is only shows about 50% physical memory usage, yet it is also using over 400MB of swap. Why would it start using swap if all of the physical memory isn't used?
Quote:
top - 14:52:31 up 6 days, 8:08, 2 users, load average: 4.75, 6.25, 4.78
Tasks: 166 total, 3 running, 163 sleeping, 0 stopped, 0 zombie
Cpu(s): 65.3% us, 15.8% sy, 0.0% ni, 14.5% id, 3.6% wa, 0.7% hi, 0.0% si
Mem: 1035800k total, 352276k used, 683524k free, 5212k buffers
Swap: 2048184k total, 445832k used, 1602352k free, 50876k cached
|
|

05-18-2006, 10:17 PM
|
|
Web Hosting Master
|
|
Join Date: Mar 2006
Posts: 644
|
|
Hi,
The physical memory usages depends upon the hardware and os kernel.Some may use 90 % of ram memory (physical memory) and 40 % of swap memory, others may use 50% physical memory and 50% swap memory . Its fully depends upon the hardware configuration
|

05-18-2006, 10:24 PM
|
|
Disabled
|
|
Join Date: May 2006
Posts: 9
|
|
On one of the servers I manage, I have seen the swap be completely used up while the physical memory is fine. It is an interesting anonmaly.
|

05-18-2006, 11:34 PM
|
|
I like ice cream
|
|
Join Date: Mar 2003
Location: California USA
Posts: 11,634
|
|
On 2.6 kernel there is a sysctl setting:
Quote:
Since 2.6, there has been a way to tune how much Linux favors swapping out to disk compared to shrinking the caches when memory gets full.
When an application needs memory and all the RAM is fully occupied, the kernel has two ways to free some memory at its disposal: it can either reduce the disk cache in the RAM by eliminating the oldest data or it may swap some less used portions (pages) of programs out to the swap partition on disk. It is not easy to predict which method would be more efficient. The kernel makes a choice by roughly guessing the effectiveness of the two methods at a given instant, based on the recent history of activity.
Before the 2.6 kernels, the user had no possible means to influence the calculations and there could happen situations where the kernel often made the wrong choice, leading to thrashing and slow performance. The addition of swappiness in 2.6 changes this. Thanks, ghoti!
Swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cache. At 100, the kernel will always prefer to find inactive pages and swap them out; in other cases, whether a swapout occurs depends on how much application memory is in use and how poorly the cache is doing at finding and releasing inactive items.
The default swappiness is 60. A value of 0 gives something close to the old behavior where applications that wanted memory could shrink the cache to a tiny fraction of RAM. For laptops which would prefer to let their disk spin down, a value of 20 or less is recommended.
As a sysctl, the swappiness can be set at runtime with either of the following commands:
sysctl -w vm.swappiness=30
echo 30 >/proc/sys/vm/swappiness
|
|

05-19-2006, 09:30 AM
|
|
Aspiring Evangelist
|
|
Join Date: Feb 2002
Location: Indiana
Posts: 367
|
|
I too wondered about this, on my machine even after a reboot my memory useage jumps to about 90-95% and usually stays there, however it's never once used swap.
-Michael
|

05-19-2006, 02:35 PM
|
|
Web Hosting Guru
|
|
Join Date: Aug 2005
Location: PA
Posts: 307
|
|
It is only a concern if you are actually seeing a slowdown. Could it have been a case where a lot of RAM was used, say by a webstats program, then was freed when the program exited? In such a case, pages that were swapped out, but haven't been needed since, would stay in swap.
__________________
reliable colocation ... Dedicated Servers | Dedicated Server VMs | FAST links to Vitelity.com and Conexiant.net
patrick@zill.net  Cell +1.717.201.3366
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|