On Thu, Jul 21, 2011 at 8:29 PM, Grant <emailgr...@gmail.com> wrote: >>> Its more how much i/o rather than the size. If you have a bunch of >>> stuff swapped out, but it hardly ever needs to be swapped in, the >>> impact will be low. >>> >>> Keep an eye on the use with vmstat; >>> >>> adam@rix ~ $ vmstat 5 >>> procs -----------memory---------- ---swap-- -----io---- -system-- >>> ----cpu---- >>> r b swpd free buff cache si so bi bo in cs us >>> sy id wa >>> 0 0 56700 351244 79564 207848 0 0 3 3 11 7 1 >>> 0 99 0 >>> 0 0 56700 351244 79564 207848 0 0 0 8 52 27 0 >>> 0 100 0 >>> 0 0 56700 351244 79564 207848 0 0 0 0 45 14 0 >>> 0 100 0 >>> 0 0 56700 351244 79564 207848 0 0 0 0 47 17 0 >>> 0 100 0 >>> >>> from the man page; >>> Swap >>> si: Amount of memory swapped in from disk (/s). >>> so: Amount of memory swapped to disk (/s). >>> >>> >> Exactly! My system is the same way. >> >> Right now I've got a 4GB system that's using 708MB swap. But vmstat >> isn't showing any swap activity. Why? Because some processes that I'm >> not aware about because I'm obviously not using, got swapped out a long >> time ago, and Linux is using that reclaimed RAM to compile chromium ;) >> >> If/when I need part of that 708MB becomes active, Linux will swap it >> back in in one short burst that I doubt that I'll even notice. > > Then why not have a really big swap file? If swap is useful as a > second layer of caching behind RAM, why doesn't everyone with some > extra hard drive space have a 100GB swap file?
I have 12GB of RAM and 12GB of swap on my main PC. Why? Because... why not? :) After 5 days uptime, it actually has 89M of swap used for some reason. It has over 10GB cached. All of my sysctl vm.* settings have been left to the defaults. So I guess it just pushed some unused stuff out to swap to make room for more caching.