Outdated rules of thumb

Story: Linux: Should You Use Twice the Amount of Ram as Swap Space?Total Replies: 20
Author Content
jezuch

Nov 20, 2008
3:05 AM EDT
There should be a special process for phasing out outdated rules like this one with swap. Moore's law (applied to RAM, not processors) made it obsolete some time ago and nowadays it's absolutely feasible to run without swap at all. I actually regret now that I wasted a few GB's for a swap partition on my new work laptop :)
gus3

Nov 20, 2008
3:41 AM EDT
With 4G in my desktop (never thought I'd see that day!), I need no swap. My memory demands never go over 50%, excluding cache.

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

Nov 20, 2008
3:41 AM EDT
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).
azerthoth

Nov 20, 2008
12:14 PM EDT
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.
ColonelPanik

Nov 20, 2008
12:20 PM EDT
Thanks all, now this is a little clearer to me.

azerthoth: 1Gig swap seems reasonable in light of what was posted above.
vainrveenr

Nov 20, 2008
1:01 PM EDT
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.
Steven_Rosenber

Nov 20, 2008
3:03 PM EDT
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.

machiner

Nov 20, 2008
8:23 PM EDT
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.
tuxchick

Nov 20, 2008
8:37 PM EDT
As a rule of thumb, rules of thumb expire after ten years.
tracyanne

Nov 20, 2008
10:27 PM EDT
My thumb is more than 10 years old, so I guess it's an expired rule of thumb.
jacog

Nov 21, 2008
2:55 AM EDT
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*
tuxchick

Nov 21, 2008
2:55 AM EDT
**ducks flying chairs**
happyfeet

Nov 21, 2008
12:28 PM EDT
Quoting:expired rule of thumb
- LOL
ColonelPanik

Nov 21, 2008
12:58 PM EDT
Thumbs Rule!

Are there more of these computer rules of thumb that we should be looking at and maybe retiring?
Sander_Marechal

Nov 21, 2008
5:18 PM EDT
@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?
gus3

Nov 21, 2008
5:51 PM EDT
@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...
Sander_Marechal

Nov 21, 2008
5:58 PM EDT
@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?
gus3

Nov 21, 2008
6:52 PM EDT
@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.
jezuch

Nov 22, 2008
10:00 AM EDT
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 :)
tracyanne

Nov 22, 2008
4:55 PM EDT
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.
herzeleid

Nov 22, 2008
7:01 PM EDT
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.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!