[H-GEN] What size swap space is optimum?
Benjamin Robert Carlyle
benc at foxboro.com.au
Mon Apr 23 03:41:34 EDT 2001
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
Webmaster wrote:
>
> [ Humbug *General* list - semi-serious discussions about Humbug and ]
> [ Unix-related topics. Please observe the list's charter. ]
> [ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]
>
> Further to my question on determining whether swap space is active, here's
> something else that's been bugging me.
>
> Ten months ago when I was a Linux newbie ;-) I read all of the expert tomes I
> could find during installation. The advice given regarding an optimum size
> for swap space was rather conflicting. The most well-argued I came across said
> that it should not exceed twice the size of system RAM, otherwise the SS
> manager would spend more time looking after it than getting things done, and
> that a swap partition equal to RAM could be optimum. Seemed reasonable, and
> since it was the only suggestion that put an UPPER limit on the partition size,
> I first experimented with 2 x RAM and at present use 1 x RAM. I now think that
> this may be too small.
>
> Any words of wisdom from the Assembled Gurus out there in CyberSpace?
Easy.
You have as much swap space as you need, never any less.
If you need a lot of swap space, your system will be slow.
If you need a lot of swap space and you need your system to be
fast,
you don't need a lot of swap space. You need more memory.
Most of the time spent dealing with swap space will be actual
physical disk access. The CPU load of performing swap
operations isn't large, although the interruptions the
processer gets can make it less efficient than it should be.
Normal access to memory occurs by direct pointer lookups on
virtual memory which are translated relatively quickly to
lookups on real memory. When memory is not where it should be
(ie, it has been swapped out), the CPU will be interrupted and
will run a routine to go fetch the memory before the pointer
dereference is finished. The name of this system of fake
pointer addresses is "virtual memory", which is why you will
hear folks refer to swap space as virtual memory. In fact,
all addresses in the protected memory space of a UNIX process
are usually under the control of the virtual memory system.
So...
I doubt you'll find that the 2xRAM limitation is a limitation
of the processor performance as much as it is a limitation of
the speed of your hard drive(s). You may be able to increase
the speed by using swap space on seperate drives and seperate
controllers, particularly on drives seperate from those that
are usually doing a lot of other work. Ultimately, though,
most hard drive technologies are a long way behind RAM
technologies when it comes to speed of retreival.
Benjamin.
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list