BLU Discuss list archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss] to swap or not swap
- Subject: [Discuss] to swap or not swap
- From: jack at coats.org (Jack Coats)
- Date: Fri, 5 Sep 2014 08:50:32 -0500
- In-reply-to: <1409923821.13713.6.camel@micphys04.nci.nih.gov>
- References: <1409747695.27353.2.camel@micphys04.nci.nih.gov> <61a78baedbeb433297a1279234b2328c@CO2PR04MB684.namprd04.prod.outlook.com> <1409923821.13713.6.camel@micphys04.nci.nih.gov>
I agree, I do LIKE to have swap as a case of both belts and suspenders. Before you do without swap, answer a few questions... 1. Is my application well defined and well behaved? 2. Is this system monitored closely? 3. Are others capable of updating and maintaining this system? If 1 or 2 is NO or 3 is YES, then I would add swap. There are other good rules of thumb, but the first question implicates the entire answer to me. Best of luck! ... jack On Fri, Sep 5, 2014 at 8:30 AM, Stephen Adler <adler at stephenadler.com> wrote: > Thanks for the discussion. The question, which seems to have gotten lost > in the original e-mail was that I have a system with 128Gigs of memory > and I added 32Gigs of swap just because I've always added some swap to > any system I configure. (It's like brushing your teeth in the morning, > you just do it...) But with 128Gigs, which is the largest amount of > memory I've worked with in any system, it dawned on me that perhaps I > don't need any swap.... So, to swap or not to swap was the question. > > thanks. > > On Fri, 2014-09-05 at 13:22 +0000, Edward Ned Harvey (blu) wrote: >> Did you want to have a discussion about swapping? >> >> Everyone would agree, you should always avoid swapping unless the memory requirement of some job exceeds the maximum ram you can put into your system, or unless it's a one-off job, or you simply don't care if it takes 100 or 1000 times longer than necessary, and nothing else in the system matters. >> >> I've certainly seen machines start swapping some active processes, and they become totally unresponsive. Ssh got swapped out, and can't get enough CPU share to respond to a login request before the client times out. You were lucky that you already had a logged-in terminal sitting there, and you can still "ls" because that was super hot in the cache and hasn't been expunged yet, but if you type "top" or "ps" or something that was already ejected from cache, then your prompt simply hangs indefinitely, as long as the runaway process is still active in swap memory. >> >> Some people would suggest disabling swap entirely, but I don't believe that's best. When you allow your system to have a small amount of swap (say 1G) then the kernel is able to swap idle processes and dead/zombie processes, making more room for cache & buffers & other stuff, which improves performance. By keeping the swap small, you limit the length of time that you get crushed, in the event a process accidentally runs away and gobbles memory incessantly. With 512M or 1G of swap, usually a runaway process will cause your system to utterly suck for a couple of minutes before the runaway process dies and things return to normal. >> >> This latter argument doesn't carry a lot of value. If you login to some long-running existing system you have, and check "top" or "free" you'll see some amount of swap space consumed, usually non-zero, but usually pretty small anyway. Say 10M or maybe 100M. So the real truth is, there's not much memory to gain by swapping out the dead/idle processes. "Yay, I've effectively increased my 16GB system to 16GB & 10MB." But I still recommend adding a small amount of swap to systems. >> >> > > > _______________________________________________ > Discuss mailing list > Discuss at blu.org > http://lists.blu.org/mailman/listinfo/discuss -- ><> ... Jack "Whatever you do, work at it with all your heart"... Colossians 3:23 "If you are not part of the solution, you are part of the precipitate" - Henry J. Tillman "Anyone who has never made a mistake, has never tried anything new." - Albert Einstein "You don't manage people; you manage things. You lead people." - Admiral Grace Hopper, USN "a nanosecond is the time it takes electrons to propigate 11.8 inches" - " - http://youtu.be/JEpsKnWZrJ8 "Life is complex: it has a real part and an imaginary part." - Martin Terma
- Follow-Ups:
- [Discuss] to swap or not swap
- From: richard.pieri at gmail.com (Richard Pieri)
- [Discuss] to swap or not swap
- References:
- [Discuss] to swap or not swap
- From: adler at stephenadler.com (Stephen Adler)
- [Discuss] to swap or not swap
- From: blu at nedharvey.com (Edward Ned Harvey (blu))
- [Discuss] to swap or not swap
- From: adler at stephenadler.com (Stephen Adler)
- [Discuss] to swap or not swap
- Prev by Date: [Discuss] to swap or not swap
- Next by Date: [Discuss] to swap or not swap
- Previous by thread: [Discuss] to swap or not swap
- Next by thread: [Discuss] to swap or not swap
- Index(es):