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

Re: Automatic allocation of swap



Hi,

On Sun, Aug 01, 2004 at 09:04:50PM +0800, John Summerfield wrote:
> 
> I have just installed another system, and took the time to try to 
> familiarise myself with the partitioning tool.
> 
> I was running a 2.6 kernel, and the install kernel's date is Jul 29 06:24.
> 
> The install target was a Pentium II, 350 Mhz, 64 Mb RAM and 3.2 Gbytes 
> of disk.
> 
> It seemed to me that the setup chosen for "multiuser" was entirely 
> impractical. Unfortunately, I was more interested in testing other 
> aspects, so I just wiped that one and tried some others.
> 
> One aspect of that configuration I do recall.
> 
> It allocate about 192 Mbytes of swap partition, right at the edge of the 
> disk.

Hmm.  put it to the edge may not be the best thing to do ... 
Does this have any real impact?

> I have never thought swap partitions on single-disk systems are a good 
> idea, and here is why.
> 
> 1. Performance
> If there is little swapping, then any perfoemance benefit is immaterial.

So do not complain swap is not at the center.

> If swapping is severe (the system is thrashing), there is no good 
> alternative to more RAM. RAM is cheap.

That is different problem. Swap will not be used unless RAM is used up.

> That aside, the position of the swap area (in the d-i configuraton as 
> in most others) ensures the swap area is far from the data, ensuring 
> that operations such a opening an OOo document will send the disk heads 
> seeking far, back and forth, back and forth, back and forth, across 
> much, maybe most, of the disk surface.

Then buy a RAM.  Optimization you get with swap location is small.

> In between, of course, is inbetween: bad sometimes, not so bad at others.
> 
> In contrast, if I create a swap file, then it there is some prospect it 
> will be near at least some of the data I need to read.

I do not understand...

> 2 Flexibility.
> The common Rule of Thumb (ROT) has the appropriate size of swap being 
> twice the amount of RAM installed (not three times!).

I thought "at least 2 X RAM".  So 3 X is OK.  Besides, it is less than
10% of disk space.  Who cares lost space.  You can ajust it later if you
care.

> My own experience is that, mostly, system performance is pretty terrible 
> before it's used all the swap area. The sole counterexample I can think 
> of is using rsync to do backups. rsync can use enormous amounts of 
> virtual memory backing up whole disks, but its working set remains modest.

???  (Maybe you are talking bad swap logic of some 2.4 kernels.  But
this does not make us stop using swap.)

> The stupidity of this ROT is illustrated when adding more RAM. If my 
> system is working moderately well with xMbytes of RAM and I, noting that 
> RAM is cheaper than formerly, decide to add 2x Mbytes of RAM, should I 
> also treble the amount of swap? Of course not, I may well decide I have 
> better uses for that disk space.

I do not think adding ram later has negative impact and I do not call
this setup stupid :)  ....

> Either way, the amount of swap is wrong, and recovering or enlarging the 
> amount of swap  in a swap partition is not a trivial undertaking.

I think it is trivial if you have empty unused diskspace.  (I am
comparing this to moving and resizing ext2 partition.)

You can do swapoff then you can change swap partition to elsewhere.

> Finally, the point that I installed a 2.6 kernel is an important one. 
> One of the changes I note in the new kernel is that there is no 
> performance benefit to using swap partitions.

What?  Try running a program which leaks memory.   With swap, you will see
slower degradation, thus enhancing your chance to avoid bad crash
quickly.

(I think you were annoyed some non-optimal swap usage in the previous 
kernels. That is different matter though.)

> I recommend that, if there is one disk, a swap file be created rather 
> than a swap partition.

Nay.  Does this something other distribution zstarted to do with some
reason.  At least this was not normal thing. 

> And, if /home is a separate partition, then it should be on that 
> partition. That is where most I/O activity is likely to be on 
> single-user systems.

Well I tend to partition

 /
 swap
 /usr
 /var
 /home

in this order... but I do not think this order is something absolute.

Osamu



Reply to: