Linux: Should You Use Twice the Amount of Ram as Swap Space?
|
|
|
Comments (21)
1 earlier comment in the full thread.
I don't think it's wasted at all. Some applications do leak memory and you don't want to run out of RAM. Using a small swap partition and hooking some alerts to it is an excellent way to get notified something is wrong. Even if you don't notice the sudden slowdown when your box start swapping, you can get alerts that swap is being used and take corrective action (like kill -9 on the RAM hoggers).
I still hold with the thought that regardless of how much memory you have, or how seldomly you actually dip into it, you should maintain a swap partition. If for no other reason than as Sander points out, a quick way to know when something is going wrong. I have however dropped the old addage, now I'll double ram until I hit 1 Gig swap, anything after that stays at 1 gig swap.
Thanks all, now this is a little clearer to me.
azerthoth: 1Gig swap seems reasonable in light of what was posted above.
azerthoth: 1Gig swap seems reasonable in light of what was posted above.
Also see the excellent LXer comments at '113%', http://lxer.com/module/forums/t/26415/
Original Newswire posting was 'All about Linux swap space', http://lxer.com/module/newswire/view/96757
Gary Sims' piece is a must-read just as is Vivek Gite's.
Original Newswire posting was 'All about Linux swap space', http://lxer.com/module/newswire/view/96757
Gary Sims' piece is a must-read just as is Vivek Gite's.
I'm glad somebody started a thread about this. The whole "double the RAM" swap suggestion seems counterintuitive to me. It really harshed my proverbial mellow to do this on a 3 GB hard drive (yep, I've got a few of them), so I pretty much did the same swap as RAM.
But on a "modern" hard drive, giving up a GB for swap should be no big deal. I think azerthoth has it right -- 1 GB max.
But on a "modern" hard drive, giving up a GB for swap should be no big deal. I think azerthoth has it right -- 1 GB max.
I only employ swap for hibernating. Having a swap partition otherwise on a regular desktop with 2GB of RAM or better would be silly, I think.
As a rule of thumb, rules of thumb expire after ten years.
My thumb is more than 10 years old, so I guess it's an expired rule of thumb.
Innit funny how, if you repeat the same word or phrase enough times, it eventually starts to sound redundant, akward, stupid?
Come on all... say it with me... rule of thumb... rule of thumb... rule of thumb... rule of thumb... rule of thumb... rule of thumb...
... and while we're at it ...
interoperability... interoperability... interoperability... interoperability... interoperability...
*gets sweaty armpits and goes into cardiac arrest*
Come on all... say it with me... rule of thumb... rule of thumb... rule of thumb... rule of thumb... rule of thumb... rule of thumb...
... and while we're at it ...
interoperability... interoperability... interoperability... interoperability... interoperability...
*gets sweaty armpits and goes into cardiac arrest*
**ducks flying chairs**
Quoting:expired rule of thumb- LOL
Thumbs Rule!
Are there more of these computer rules of thumb that we should be looking at and maybe retiring?
Are there more of these computer rules of thumb that we should be looking at and maybe retiring?
@CP: Here's one, perhaps. I do it all the time but I'm not sure why anymore (especially now that grub2 supports booting from LVM): Why make a separate /boot partition?
@Sander:
A separate /boot (or /stand) partition is a good habit, harmless if unneeded on a particular system. Some non-PC's, like SPARC's, have UFS filesystem code in their boot PROM's. If the filesystem containing the boot kernel isn't on UFS, it won't load.
(Caveat: That's the last I knew. Beside me I have a Sun 4M system, for which the above is true, even with NetBSD.)
Also, PA-RISC needs UFS for its boot files, for the same reason, even though Veritas' VxFS is OEM'd for HP-UX. A common practice is to put the boot code in /stand, formatted as UFS, and all other filesystems, including root, will be VxFS.
Maybe someone else can fill us in on AIX systems. I don't remember...
A separate /boot (or /stand) partition is a good habit, harmless if unneeded on a particular system. Some non-PC's, like SPARC's, have UFS filesystem code in their boot PROM's. If the filesystem containing the boot kernel isn't on UFS, it won't load.
(Caveat: That's the last I knew. Beside me I have a Sun 4M system, for which the above is true, even with NetBSD.)
Also, PA-RISC needs UFS for its boot files, for the same reason, even though Veritas' VxFS is OEM'd for HP-UX. A common practice is to put the boot code in /stand, formatted as UFS, and all other filesystems, including root, will be VxFS.
Maybe someone else can fill us in on AIX systems. I don't remember...
@gus: But on a modern Linux box it's no longer necessary, right? So that's another old rule of thumb out the window.
Any other ones that need to go?
Any other ones that need to go?
@Sander: Only if that "modern Linux box" is a PC. Even EFI is filesystem-aware, although which filesystem is unspecified. But whichever it is (UFS, FAT32, Ext2), if it's different than the intended root filesystem in Linux, then the vmlinuz needs its own partition, or a supplanting bootloader such as elilo.
On a PC, the bootloader is pulled in using the BIOS-based bootblock scheme. With OpenBoot PROM (SPARC, PA-RISC) and EFI (Itanium, Intel-based Apple), the bootloader resides in ROM, and doesn't know where the intended code lies on disk until it begins traversing the partition and filesystem.
So, no, that rule of thumb is not out the window, and if you intend to take your Linux experience into the wider Unix world, not having this habit can get you into trouble.
On a PC, the bootloader is pulled in using the BIOS-based bootblock scheme. With OpenBoot PROM (SPARC, PA-RISC) and EFI (Itanium, Intel-based Apple), the bootloader resides in ROM, and doesn't know where the intended code lies on disk until it begins traversing the partition and filesystem.
So, no, that rule of thumb is not out the window, and if you intend to take your Linux experience into the wider Unix world, not having this habit can get you into trouble.
Quoting:But on a modern Linux box it's no longer necessary, right?
Well, I keep separate /boot partition in case I want to encrypt my / (I wanted to do it when I was installing Debian on my work laptop, but the installer wasn't quite ready, I think, and it panicked on boot). And considering that "modern" can mean "properly secured", I don't think that rule is obsolete :)
Mandriva seem to have decided that a 4 Gig (actually 3.8) partition size on on 32 bit versions will cover all bases, even if you happen to have 4 gig of RAM, and will provide suspend-to-disk with enough diskspace to function properly. So I suppose a new rule of thumb might be make the swap partition big enough to store your RAM to disk in the case of suspend-to-disk.
That swap rule is definitely only a rough guide. The real answer is that swap shoud be greater than or equal to the maximum expected working set minus physical RAM If that gives you a negative answer, you really aren't in dire need of swap.
We're getting some new linux hardware which should arrive next week, and they are coming with 64 GB RAM.
Does anyone think I'm going to carve out 128 GB swap partitions? hehe. I'm thinking 4 or 8 GB.
We're getting some new linux hardware which should arrive next week, and they are coming with 64 GB RAM.
Does anyone think I'm going to carve out 128 GB swap partitions? hehe. I'm thinking 4 or 8 GB.
Post a comment
A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.
Your message:Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help
Sign up and post (it is free) or Log in and post

With /tmp mounted as tmpfs, it also gives me a chance to find some truly outrageous numbers in Dbench.