Re: Questions regarding Linux swapping.

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 2 Aug 1999 08:30:28 +0200 (MEST)


linuxkernel@NewMail.Net wrote:
> Should I set up swap-areas on each of the disks?
>
> And if so, do I use swap-file or swap-partition?
>
>
> What is the performance difference between swap-file
> and swap-partition?

Small. A little CPU-overhead. Swapping involves IO and that's much
slower than the CPU anyway.

> And in the Slashdot discussions, there were mentioned
> about positioning swap-partition in specific areas of
> the disk to optimize diskhead read/write action.

> Some says putting swap-partitions in the outter-rings of the disks,
> some says inner-rings, while others say somewhere in the middle.

Depends if you're going to use them. The outer tracks are the fastest.
You might want to reserve them for your root filesystem which you
actually use, or you might want to decide that you're going to swap on
a regular basis, and want that extra juice out of the swap partition.

>
> I am confused.
>
> Which one is correct?

I still recommend the archaic rule-of-thumb: Twice as much swap as
physical RAM. Why? RAM is many times more expensive as disk. So at
"twice as much as RAM", you'd still pay somethng like 20 times more
for the RAM than for the disk (I didn't check current prices. Sorry)

But with current RAM-sizes you might never touch your swap. In that
case, you're better off finding some use for those faster tracks. If
on the other hand, you're poor, and can't pay for the extra RAM, or
are regularly handling extremely large data-sets, then putting it
at the beginning (outer tracks) will help.

> Does it make much differences in positioning the disk-partitions
> in the inner-, middle-, or outer-rings of the disk?
>
> There were also talks of how large the swap-areas (swap-files
> or swap-partitions) should one provide.

> Some said the size of the swap-areas depend on the RAM size.
> Others said it depended on how many applications you use.

Yeah. Covered above.

> My question about it is:
>
> How should I figure out how large should I make the
> swap-area on the disks?
>
> Is there a formula of sort to give some estimation?

Yes: Total swap = 2 x RAM.

> I am sorry if these questions were asked before, and
> I apologize again if this is not the proper forum to
> ask these questions.
>
> But in any case, if you have any answer, please cc.
> a copy of your answer to me at linuxkernel@newmail.net
> please.
>
> Before I forget, my machine is an Intel PIII 550, with
> 128M of RAM, and I do use a lot of applications that
> consume a lot of RAM space.

So, the question is: Does the rule-of-thumb work good enough for you?
Is 256Mb swap enough?

Today, a machine shouldn't need swap, but for that once-a-month event
where you happen to forget that a job is much larger than expected, it
is good to have it: the job will continue. And for that service you have
to pay the insurance fee of a swap partition.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
------ Microsoft SELLS you Windows, Linux GIVES you the whole house ------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/