FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-29-2008, 12:56 PM
"James B. Byrne"
 
Default Apparently no swap configured

Date: Tue, 28 Oct 2008 08:29:43 -0700
From: Scott Silva <ssilva@sgvwater.com>

Wrote:

> Even though the recommended swap is 2 times system memory, I have
> never made a swap partition over 2 GB. Maybe I am also flirting
> with disaster, but haven't been bit yet in years.


I believe that the current recommendation is 2 x physical memory up to 2
GB and then 1 x physical memory thereafter.

See:
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html

" Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and
then an additional 1x physical RAM for any amount above 2 GB, but never
less than 32 MB.

So, if:

M = Amount of RAM in GB, and S = Amount of swap in GB, then

If M < 2
S = M *2
Else
S = M + 2

Using this formula, a system with 2 GB of physical RAM would have 4 GB of
swap, while one with 3 GB of physical RAM would have 5 GB of swap.
Creating a large swap space partition can be especially helpful if you
plan to upgrade your RAM at a later time.

For systems with really large amounts of RAM (more than 32 GB) you can
likely get away with a smaller swap partition (around 1x, or less, of
physical RAM). "

Regards,


--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-29-2008, 01:09 PM
Stephen Harris
 
Default Apparently no swap configured

On Wed, Oct 29, 2008 at 09:56:34AM -0400, James B. Byrne wrote:
> I believe that the current recommendation is 2 x physical memory up to 2
> GB and then 1 x physical memory thereafter.
>
> See:
> http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html
>
> " Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and
> then an additional 1x physical RAM for any amount above 2 GB, but never
> less than 32 MB.

That's a silly recommendation, and never been true for Linux. RedHat
don't always know what they're talking about.

In older BSD systems (eg around SunOS 4 times or before) swap space was
utilised oddly; all memory was allocated from swap, so you needed _at
least_ <physmem> of swap just to use all your real memory! So if you
added <physmem> of swap then your total virtual memory size was still
only <physmem>. No help! So the rule of thumb came along that said
"swap = 2*<physmem>" and that gave you a VM of 2*<physmem>. Linux never
did this (and I don't think modern BSDs do, either) so adding <physmem>
of swap will automatically give you twice <physmem> of VM.

So the old BSD 'swap=2*<physmem>' rule of thumb is now a linux
'swap=<physmem>' guideline instead.

But it's still just a rule of thumb, or a guideline. How much swap you need
depends on your circumstances and load. If you have 4Gb of RAM and find
the system is using most of it for cache then you may not even need any
swap!

--

rgds
Stephen
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-29-2008, 11:36 PM
Christopher Chan
 
Default Apparently no swap configured

Stephen Harris wrote:

On Wed, Oct 29, 2008 at 09:56:34AM -0400, James B. Byrne wrote:

I believe that the current recommendation is 2 x physical memory up to 2
GB and then 1 x physical memory thereafter.

See:
http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html

" Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and
then an additional 1x physical RAM for any amount above 2 GB, but never
less than 32 MB.


That's a silly recommendation, and never been true for Linux. RedHat
don't always know what they're talking about.

In older BSD systems (eg around SunOS 4 times or before) swap space was
utilised oddly; all memory was allocated from swap, so you needed _at
least_ <physmem> of swap just to use all your real memory! So if you
added <physmem> of swap then your total virtual memory size was still
only <physmem>. No help! So the rule of thumb came along that said
"swap = 2*<physmem>" and that gave you a VM of 2*<physmem>. Linux never
did this (and I don't think modern BSDs do, either) so adding <physmem>
of swap will automatically give you twice <physmem> of VM.


Ah, yes, not an older release of Solaris...SunOS4

A certain release of SunOS4 required swap be twice the amount of RAM or
it would crash according to an article that I read but I cannot find
right now. Here is a FAQ article related to SunOS that tells us how
SunOS4 handled virtual memory (swap must be at least the same amount of
RAM): http://www.bjnet.edu.cn/sun-admin/FAQ/F-comp-sys-sun/Q30-0.html


The source of this 'recommendation' that swap be twice that of RAM is
affects more than just Linux


http://blogs.sun.com/jimlaurent/entry/solaris_faq_myths_and_facts

So please, stop spreading this swap should be twice the amount of RAM
installed nonsense.


/me gets off soapbox.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 01:07 AM
John R Pierce
 
Default Apparently no swap configured

Stephen Harris wrote:

In older BSD systems (eg around SunOS 4 times or before) swap space was
utilised oddly; all memory was allocated from swap, so you needed _at
least_ <physmem> of swap just to use all your real memory! So if you
added <physmem> of swap then your total virtual memory size was still
only <physmem>. No help! So the rule of thumb came along that said
"swap = 2*<physmem>" and that gave you a VM of 2*<physmem>.



<old codger hat> this was also how early IBM System/370 DOS/VS
worked... the swap space (which was contiguous cylinders of the disk,
btw) was mapped 1:1 to virtual memory address space </old codger hat>


now, on late model Solaris, 'swap' is also used as tmpfs, which /tmp and
/var/run utilizes by default, so you definitely want to allocate
sufficient swap space for this at least, regardless of how large your
physical memory is.



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 01:21 AM
Stephen Harris
 
Default Apparently no swap configured

On Wed, Oct 29, 2008 at 07:07:03PM -0700, John R Pierce wrote:
> Stephen Harris wrote:
> >In older BSD systems (eg around SunOS 4 times or before) swap space was
> >utilised oddly; all memory was allocated from swap, so you needed _at
> >least_ <physmem> of swap just to use all your real memory! So if you
> >added <physmem> of swap then your total virtual memory size was still
> >only <physmem>. No help! So the rule of thumb came along that said
> >"swap = 2*<physmem>" and that gave you a VM of 2*<physmem>.

> now, on late model Solaris, 'swap' is also used as tmpfs, which /tmp and

You also had this option on SunOS4 but it wasn't used by default and had
a lot of limitations and didn't really work too well for /tmp (IIRC,
didn't support FIFOs and some other file types). The Solaris version
(first appeared in Solaris 2.1, so it's not _new_) is a LOT better :-)

> /var/run utilizes by default, so you definitely want to allocate
> sufficient swap space for this at least, regardless of how large your
> physical memory is.

And, no matter what, ensure you limit your /tmp size with the size=####m
option in vfstab, otherwise someone will clobber your machine!

To bring this back to Linux... Linux _also_ does have tmpfs which works
similarly to Solaris. If you use that then also remember the size
option :-)

--

rgds
Stephen
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 09:10 AM
"William L. Maltby"
 
Default Apparently no swap configured

On Wed, 2008-10-29 at 19:07 -0700, John R Pierce wrote:
> Stephen Harris wrote:
> > In older BSD systems (eg around SunOS 4 times or before) swap space was
> > utilised oddly; all memory was allocated from swap, so you needed _at
> > least_ <physmem> of swap just to use all your real memory! So if you
> > added <physmem> of swap then your total virtual memory size was still
> > only <physmem>. No help! So the rule of thumb came along that said
> > "swap = 2*<physmem>" and that gave you a VM of 2*<physmem>.
>
>
> <old codger hat> this was also how early IBM System/370 DOS/VS
> worked... the swap space (which was contiguous cylinders of the disk,
> btw) was mapped 1:1 to virtual memory address space </old codger hat>
> <snip>

<another old codger hat>
I believe the differing "recommendations" is a result of the transitions
over the life of *IX systems. When I first began running real UNIX (TM)
on Dec and PC equipment (1978-1985), memory was slow, expensive and
limited. Ditto for HD space. In order to run even fairly basic systems
with any utility involving multi-tasking or multi-users, swap was need
to page memory. Tunables were provided for high/low water marks and
preferences for high/low priority processes. IIRC, initially there was
no oom kill capability.

Recommended swap at that time was at least two times real memory and 4
times for "heavily loaded" systems. If you were doing more, bump that
number appreciably. But it had severe costs when you maximum HD size
might be 40MB, so you didn't want to over-allocate.

Over time, memory/HD attributes and "flavors" of *IX changed.
Applications changed. Shared memory, libraries came into vogue.
Relocation became possible. ELF appeared.

All this stuff changed the real needs for swap. But old habits die hard.
So we still have conflicting recommendations floating around. Several on
this list have been successfully configuring 0 swap for their usage. For
other usage that may not be appropriate.
</another old codger hat>

Summary: as it always has been, your application and load profile
determine the need. Since HD is so "cheap" now, I have a couple gig of
swap, but haven't seen it used since sometime in CentOS 5.0. Even when I
login in as multiple users and fire up several X/Gnome desktops for
each, no swap usage. There's probably been some swap used, but it wasn't
seen by me.

--
Bill

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 09:28 AM
Karanbir Singh
 
Default Apparently no swap configured

Stephen Harris wrote:

" Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and
then an additional 1x physical RAM for any amount above 2 GB, but never
less than 32 MB.


That's a silly recommendation, and never been true for Linux. RedHat
don't always know what they're talking about.


I disagree with that. It has been true for linux for a long time, and is
true even now. When was the last time you looked at the linux swap
handling code ?


Recently, with large amounts of ram available on physical machines, eg >
2 GB, you need to start reconsidering a part of that strategy based
around the fact that if your machine is really using 2 GB+ of swap,
there might be other problems that need fixing and the absurd levels of
latency introduced by that would mean those other issues really need
looking at.


I'd still go with 2xRAM size for swap size upto a swap size of 2 GB,
then make it the same as RAM size, till you get to 32 GB, at which
point, half of real RAM size till 128 GB. Beyond that point, you really
should be doing some benchmarks and monitoring to work out how much swap
you need, and where it needs to be.


The other school of thought that seems to be doing the rounds is, 2xRAM
till 4 GB, then just leave swap at 4GB irrespective of what your real
machine RAM is, as long as its a multiple of 4.


--
Karanbir Singh : http://www.karan.org/ : 2522219@icq
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-31-2008, 05:00 AM
Ian Masters
 
Default Apparently no swap configured

Hello,

Just in case anyone wants to follow my original problem in the future, I
resolved my no swap problem according to Nate's advice as follows:

1. Confirmed that /dev/VolGroup00/swap was not in use by the system
2. Ran the following commands:
mkswap /dev/VolGroup00/swap
swapon /dev/VolGroup00/swap
3. Added the following to fstab:
/dev/VolGroup00/swap swap swap defaults
0 0

Swap partition now showing as follows, using 'free':
total used free shared buffers cached
Mem: 3960252 463208 3497044 0 30876 350164
-/+ buffers/cache: 82168 3878084
Swap: 2031608 0 2031608

Thanks to the list and Nate in particular for the assistance.

Ian Masters


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 05:53 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org