LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Swap Partition Size (http://www.linuxquestions.org/questions/slackware-14/swap-partition-size-346638/)

Murdock1979 07-25-2005 02:21 PM

Swap Partition Size
 
Hello Fellow Linuxens!

I know this must be a popular question, but what is a good size for a swap partition.

Here are my computer specs:
PIII 600 MHz
hda1 20 Gigs
hda2 20 Gigs
256 MB RAM

I hardly use any of this space, so I can resource a lot to a swap partition.

They say one should give at least the amount of memory, so 512 MB is a minimum, but does the policy of "more the marrier" apply?

And just to add to the story, I am using UMDOS, so it's located on a FAT filesystem (kinda slows things down anyways) and are using a swapfile for the swap partition.

Any suggestions would be great!

Cheers,
Mords

J_K9 07-25-2005 02:31 PM

You won't be needing TOO much, so I generally go by the rule of either having a swap partition either the same size as your RAM, or double. I usually go for double my RAM, so in your case your swap would be 512MB, but I tend to go slightly over the top! ;)

J_K9

xushi 07-26-2005 01:44 AM

Quote:

They say one should give at least the amount of memory, so 512 MB is a minimum, but does the policy of "more the marrier" apply?
Not as long as you have more than ~400Mb of ram... I don't know the reasons for that rule, and i certainly don't know why its still being used nowadays.

RAM is cheap.. if you have more than 512 then you shouldn't worry about your swap. I had 1G of ram on my old laptop, with a swap of 128Mb, and it never used that swap space, to my knowledge...

As for this laptop, it has 512Mb, with swap of 256, and the only time it ever uses it is when i get memory leaks.. (i stress test alot)

Ofcourse it all depends on what you're doing on the system.. If its running X (ram hogger), apache, mysql, samba, etc... Then make sure you have 512 RAM and above (with a low swap of ... 256M max). The swap will be just for failsafe purposes.

MS3FGX 07-26-2005 01:56 PM

Yes, the old:

RAM x 2 = Swap

Rule is becoming quickly outdated with modern computers. With most machines shipping with 512 MB now, and the price of RAM so low, it is becoming less and less likely that a modern desktop machine will ever swap out.

Personally, the most I do anymore (assuming the machines has enough RAM) is swap=RAM. Even then, this is usually overkill, and I don't know of any time my current desktop machine has ever accessed the swap.

But, as habits tend to do, this one is dieing hard. Many people still stick to the RAMx2 rule simply out of habit.

tuxdev 07-26-2005 02:09 PM

I usually say Swap=RAM*2, Swap <=256MB

xushi 07-26-2005 02:14 PM

I usually say
Swap = 256 | RAM >=256
Swap = 256 | RAM <= 256

For the reason of swap not being that important anymore.. (to a normal user)

brokenflea 07-26-2005 02:17 PM

what about notebook's when they hibernate, isn't swap used when you hibernate your notebook or am i completely off track here ?

xushi 07-26-2005 02:23 PM

Quote:

Originally posted by brokenflea
what about notebook's when they hibernate, isn't swap used when you hibernate your notebook or am i completely off track here ?
Hmm, the contents of RAM is copied onto your HD to hibernate, and is copied back into RAM when waking up.. But i don't think the destination is your swap.

Swap is usually used in systems with low RAM for paging information that isn't instantly needed by the system, to leave the RAM free for more critical data that is currently needed.

Murdock1979 07-26-2005 02:29 PM

Hello!

Wel, just for a quick swap piece of info. I loaded linux with UMDOS and with only 512K swapfile, and it was snailslow. I figured I'd test it out gave it a 1 Gig swapfile. It speeded up by more than three times (thereabouts).

With all the mess it's doing with the VFAT filesystem, I'm sure there is a whole bunch of swapping going around.

Well, just letting you guys know,
Mords

xushi 07-26-2005 02:46 PM

Setting it to 512k is a bit of an underkill :)

Either set it to something low as 128/256, or just disable it.

ibmercurial 07-26-2005 08:13 PM

From what I read swap can be =ram if ram is ddr and= or > 512Mb
I have ddr but still make swap partiton ram*2

J.W. 07-27-2005 01:09 AM

Swap is only used when the load placed on RAM pushes it past capacity, and the system is forced to write memory pages out to disk. Back in the days where 32Mg or 64Mg of RAM was considered hot stuff, it was not difficult to overload RAM, but these days, where 512Mg is the standard for a new PC, the chances that you'd consume >100% of RAM are increasingly remote. In the old days, it was recommended that "Swap = 2xRAM', but these days, if you follow that rule pretty much the only thing you'd be doing would be to waste disk space by allocating a huge swap partition. Personally, I'd recommend setting up a 256 Mg swap space, regardless of how much RAM you have.

While we're on the topic, let's not overlook the fact that the more your system uses swap, the worse your overall performance will be. Why? Because accessing data that's already in RAM is measured in nanoseconds, while accessing data that's been written out to disk is measured in milliseconds -- that's several orders of magnitude slower. Not good - it's far better to keep your swap usage as close to zero as possible. Again, if you've got a 256Mg swap space, I'd say you'll be good no matter how much RAM you've got -- J.W.


All times are GMT -5. The time now is 09:59 PM.