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

Automatic allocation of swap

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.

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.

If swapping is severe (the system is thrashing), there is no good alternative to more RAM. RAM is cheap. 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.

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.

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

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.

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.

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.

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.

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

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.



-- spambait
1aaaaaaa@computerdatasafe.com.au  Z1aaaaaaa@computerdatasafe.com.au
Tourist pics http://portgeographe.environmentaldisasters.cds.merseine.nu/

Reply to: