Linux Swap partition
Author
Discussion

marlboro

Original Poster:

637 posts

295 months

Friday 21st May 2004
quotequote all
The normal suggestion is that the linux swap should be double the memory size.

My Linux PC has 1Gig memory, do I really need to reserve 2Gig for swap??
It has a 40Gb HDD and enough free space so its not a problem to resize. Current swap 512Mb.
Just wondered how important this is with a large amount of memory??

Its, Mandrake 9.1 running on Athlon 1600+.

Cheers
Brian

rebelstar

1,146 posts

268 months

Friday 21st May 2004
quotequote all
The suggestion dates back to when 16Mb was a lot of memory. I'm running with 1Gb of ram and 512Mb of swap - and it hardly swaps at all.

The ratio of CPU speed vs disk speed has grown a lot over recent years so you could notice massive slowdowns in performance when (if) swapping starts (depending partly if you're running as a workstation or a server, of course).

JamieBeeston

9,294 posts

289 months

Friday 21st May 2004
quotequote all
I have a gig in my server, I used to run it with 0 swap, but got annoyed with the Get_swap_failed log errors, so I just assigned a few gig to it.

Its not like I need the space, and as I did it as a file, instead of a partition, I can always remove / resize it at will.

Pigeon

18,535 posts

270 months

Saturday 22nd May 2004
quotequote all
I just give it 2 gig because what's 2 gig these days? It rarely uses more than a fraction of it, but rarely != never.

TheHobbit

1,189 posts

275 months

Saturday 22nd May 2004
quotequote all
we have ~1500-1800 linux servers around the world, most have 768 meg or a gig of ram, and all have 500meg of swap IIRC. all appear happy enough

annodomini2

6,964 posts

275 months

Saturday 22nd May 2004
quotequote all
Basically it depends what programs you run and how much memory load you get, if you run programs that require to keep 2GB of data statically in ram (they do exist!) then a larger swap file would be required.

But I would have thought in normal usage that 512mb would be adequate.

donatien

1,113 posts

282 months

Saturday 22nd May 2004
quotequote all
Historically Unix wanted a swap size of 2xRAM + a bit for contingency. In those days disk was far cheaper than memory, and memory was expensive.

An early machine I used was an ICL DRS3000. Had a 33 MHz 486 and 32 MB (yes 32 MB) and easily supported 6 users logged in with 3-4 sessions each. You couldn't p1ss in 32 MB these days.

Now, when I build Linux/Unix boxes I use a swap size just bigger than the RAM installed. That way if a system dump occurs the kernel can write out the full image to swap which can be recovered and analysed. Never needed to do this so it's superstition really. A well behaved Linux box with 512MB of RAM isn't going to get too stressed unless you want to forecast the weather or are running some serious enterprise stuff.

Dave

Bodo

12,523 posts

290 months

Saturday 22nd May 2004
quotequote all
I have 1GB RAM, and made 1GB swap too, although I RTFM and it said 2x RAM for swap.
Swap is only used (there's a graphical tool available for GTK www.gkrellm.net and another one comes with KDE), when I open large CAD-assemblies, or creating DIN A0 size postscripts at 300dpi.