[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: swap maxed out when plenty of RAM available



On Tue, Mar 22, 2022 at 10:35:40AM -0600, Charles Curley wrote:
> On Tue, 22 Mar 2022 14:55:34 +0000
> Adam Weremczuk <adamw@matrixscience.com> wrote:
> 
> > It has 512 MB of memory and 512 MB of swap assigned and typically
> > needs 50-100 MB to operate.
> 
> The rule of thumb to which I am accustomed is to have a swap space
> double the physical RAM. If necessary, you can create a swap file and
> add that to your /etc/fstab. That might help with your current problem.

All those rules of thumb are crap.  They assume so many things that
you just can't assume.

If a system is filling up swap, that means that *at some point* there
was enough simultaneous memory demand from applications to require
filling up swap.  That memory demand might not exist *right now*, but
at some point, it did.  This might mean it's likely to occur again.
Or maybe it was a one-time thing.  Who can say?  Only the person whose
system it is.

The OP is going to need to gather a lot more data, unless they can
remember something like "Oh wait, I compiled emacs on this system the
other day; maybe that used a lot of memory."  Maybe set up a service
to run "vmstat 5" at boot and redirect it to a file.  Then if the full
swap partition is observed again, they can look at this file and at
least get an estimated timeframe for when the high memory use occurred,
and some supporting data.  There may be better tools, but vmstat is
the first one I can think of.


Reply to: