Slashdot Mirror


How Big Should My Swap Partition Be?

For the last 10 years, I have been asking people more knowledgeable than I, "How big should my swap be?" and the answer has always been "Just set it to twice your RAM and forget about it." In the old days, it wasn't much to think about — 128 megs of RAM means 256 megs of swap. Now that I have 4 gigs of RAM in my laptop, I find myself wondering, "Is 8 gigs of swap really necessary?" How much swap does the average desktop user really need? Does the whole "twice your RAM" rule still apply? If so, for how much longer will it likely apply? Or will it always apply? Or have I been consistently misinformed over the last 10 years?

2 of 900 comments (clear)

  1. Re:separate partitions for / and /home by cayenne8 · · Score: 1, Troll
    "Is there any point to separate partitions for / and /home? I mean, if you were running different file systems on each of them I could see the point."

    I was wondering the same thing. I usually like to have 3 partitions...one for swap, one for / and one for /boot.....since I usually used something simple for boot like ext2....and reiserfs for /.

    --
    Light travels faster than sound. This is why some people appear bright until you hear them speak.........
  2. Re:Here's how big by TheLink · · Score: 1, Troll

    "taking a properly configured machine down"

    So what do you set your postgresql limits to? Firefox often uses more than 256MB.

    With 256MB process limits, 20 fat apache processes with the same php app bug and you could still hit gigs of swap and the very problem I mention - unresponsive machine - "swap death".

    My way doesn't take as much guessing (how much will this ever use reasonably etc) and works well enough.

    NOTE: I also turn vm overcommit off- because I prefer apps to run out of mem, rather than the Linux oom killer killing them (I believe freebsd also overcommits by default).

    I prefer putting up with a theoretically slightly lower performance (less disk cache) as a trade off for a more graceful failure mode where the system continues to stay up. The machine may get sluggish (to a controlled degree), but it doesn't become unresponsive.

    Maybe I don't trust "modern" kernels as much as you do. FreeBSD, Linux, Windows whatever, they're all buggy.

    You can call it poor configuration if you want. So far it has worked well enough for me.

    --