[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Web server Partitions



On Tue, Dec 16, 2003 at 10:23:50PM +0100, Magnus von Koeller wrote:
Content-Description: signed data
> On Tuesday 16 December 2003 22:12, Karsten M. Self wrote:
> > > SWAP - 1.5GB
> >
> > Rule of thumb: ?1-2x RAM.
> 
> I never understood that rule... In what way does it make sense that I 
> need more swap because I have more RAM? Seriously, I'd really like to 
> understand this.

Many programs are huge but only small parts of them need to be in memory
the rest can be maintained in swap. So you can run more programs than
physical ram alone can handle. But if you run too many programs then
you'll end up swapping the necessary parts of programs into and out of
memory each time the kernel switches processes. At which point performance
goes to hell. 

So there's a point at which more swap (without adding more ram) will
be pointless and you'd be better off having the kernel kill processes
to free ram. On the flip side if you have more ram you can make effective
use of more swap.

For example assume you have a large database program that needs 1000 megs
of memory but only 100 is used at a time. You can have 128 megs ram and
1.5 gigs swap and this is fine. But if you had two of these running at
the same time with 128 megs of ram then the performance is going to be
unacceptable no matter how much swap you have. This is because they each
need 100 megs of ram (200 total), failing that they keep swapping that
100 megs in and out each time the OS switches from one to the other.

Bijan
-- 
Bijan Soleymani <bijan@psq.com>
http://www.crasseux.com

Attachment: signature.asc
Description: Digital signature


Reply to: