Swapping when memory is idle??
Odhiambo Washington
odhiambo at gmail.com
Fri Aug 21 07:56:14 UTC 2020
On Thu, 20 Aug 2020 at 21:40, @lbutlr <kremels at kreme.com> wrote:
> On 20 Aug 2020, at 01:53, Odhiambo Washington <odhiambo at gmail.com> wrote:
> > I have a machine with 16GB RAM and not heavily used.
> > I see from `top` some things that I do not understand well.
> > Why would a system use swap when memory is idle?
>
> Efficiency. Rather than reloading from static state disk libraries, you
> reload from swapped out RAM. This is faster as the swap maps right to the
> RAM and you are not reloading libraries and following depends.
>
> An efficient system *may* use swap for any page that is not accessed for a
> certain period of time, trying to keep the system with as much memory as
> possible, or more usually a specific task will use a lot of memory, forcing
> pages to swap. This does not mean that memory was mixed out nor does it
> mean you need more RAM.
>
> Once a page is in swap it will stay there until it is needed. So over the
> course of time, swap will tend to grow to some stable size, especially if
> you have a lot of rarely used services/libraries running.
>
> If you have low uptime and high swap, that probably means something in
> your initial startup is using a lot of memory, but if the uptime is long,
> swap is probably going to grow.
>
> And that is fine. You want you memory to be used.
>
> I looks to me like your system is quite well used in terms of memory.
> There is 156M of free memory, but plenty of inactive and purgeable
> (laundry) which looks like a healthy system to me.
>
> These are the important numbers, as long as the Free number is low, then
> high numbers in inac/laundry are what you want. If these are low and Free
> is also low, then your system is struggling.
>
After this great explanation, it turns out that what I was seeing is
actually a good thing! My limited reasoning was that a system should always
use swap when it runs out of memory. And this stupid line
of thought has been in my mind since forever!!! :-)
Thank you very much for the explanation.
--
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254 7 3200 0004/+254 7 2274 3223
"Oh, the cruft.", grep ^[^#] :-)
More information about the freebsd-questions
mailing list