Sizing your swap space (part 2)

May 15, 2007

On modern machines, the temptation is to make heroically big swap sizes; you'll hardly notice giving your swap 5G or 10G, and it means that you can just forget about the whole worry that you've made it too small. But this can be counterproductive, because too much swap can be dangerous.

The problem with a too large swap is that it lets your system thrash itself more and more into overload, instead of outright exploding and then recovering. When a system is overloaded enough, it is simply not going to recover on its own in a reasonable amount of time, because everything is too busy paging things in to make much progress; the only way out is to do something drastic, like kill programs off and start over.

Once your system gets into this state, swap space is just rope to hang it with; the more swap space, the more rope and the longer the situation is going to continue. (Generally when things get this overloaded, the situation feeds on itself and things get worse and worse.)

So what you really want is enough swap space that your system can survive a temporary emergency long enough for you to kill the runaway process or the like, but not so much swap space that it can keep going and bog down in the mud.

(In the peculiar world of software, it is generally faster to blow the vehicle up and rebuild it from scratch than to patiently dig it out of the mud.)


Comments on this page:

From 70.49.35.216 at 2007-05-19 11:58:17:

I disabled swapping altogether on our 192GB Altix box. It originally had the 9GB SGI recommended, but it kept swap thrashing itself so badly I would have to power cycle it, as the console would even be utterly non-responsive for 30-45 minutes+.

Hasn't crashed since and I'm happy.

MikeP

Written on 15 May 2007.
« Sizing your swap space (part 1)
My rules of thumb for picking conference talks »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue May 15 22:04:12 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.