Re: using swap when there is free ram
- Date: Fri, 1 Mar 2019 20:56:21 +0300
- From: Reco <recoverym4n@xxxxxxxxxxxx>
- Subject: Re: using swap when there is free ram
On Fri, Mar 01, 2019 at 02:39:22PM -0300, Bruno Schneider wrote:
> On Fri, Mar 1, 2019 at 2:18 PM Reco wrote:
> > Please post the contents of /proc/meminfo. And "sar -r ALL 1 10", for
> > the sake of the completeness.
> $ cat /proc/meminfo
> MemTotal: 3975380 kB
> MemFree: 1886004 kB
> MemAvailable: 2307332 kB
Now that, ladies and gentlemen, is interesting.
> Buffers: 49840 kB
> Cached: 638404 kB
Especially combined with this.
> SwapCached: 28688 kB
> SwapTotal: 979928 kB
> SwapFree: 764888 kB
First, there's huge amount of unused (not to be confused with "free")
memory on your host. And no, it's not a filesystem's cache (600M), it's
really "nothing there"-unused memory which amounts 1880M.
Second, you do have *something* in the swap (220M give or take), yet
it's 28M of that which got swapped back.
Taking it all into the account, I propose the following scenario - not a
long time ago there was a process (or a couple of those). Was it the
browser, or something written in Java (or Python), or some kind of
Virtual Machine - is not relevant, but it did consume RAM. But it got
terminated, and what we're seeing here is the aftermath.
> There is no sar command on my system.
Consider installing it, the package's called sysstat.
Comes with useful diagnostic utilities of all shapes and colors, and
they *do* have a minimal resource consumption.
> > To prevent it:
> > sysctl -w vm.swappiness=0
> I just read some people arguing that 1 is better than 0 because the
> later means "never swap" while the former means "swap if out of RAM".
> I'll try 1 to see if it reduces swapping, thanks.
Whatever floats your boat. I use "10" personally, but YMMV.