Date: Fri, 21 Aug 2020 10:55:42 +0300 From: Odhiambo Washington <odhiambo@gmail.com> To: "@lbutlr" <kremels@kreme.com> Cc: FreeBSD <freebsd-questions@freebsd.org> Subject: Re: Swapping when memory is idle?? Message-ID: <CAAdA2WPVU_EcePCCvNbHhSRnT97Rz4t6ykTfhT5pY6YtGTi7CQ@mail.gmail.com> In-Reply-To: <D2FB0F28-E822-48FF-BCEF-AC023831EDBE@kreme.com> References: <CAAdA2WP8cr-uRgDRT_GX0faCSAFWORn9UMwqLZOWtLgXd0Hc9w@mail.gmail.com> <D2FB0F28-E822-48FF-BCEF-AC023831EDBE@kreme.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 20 Aug 2020 at 21:40, @lbutlr <kremels@kreme.com> wrote: > On 20 Aug 2020, at 01:53, Odhiambo Washington <odhiambo@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 ^[^#] :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAdA2WPVU_EcePCCvNbHhSRnT97Rz4t6ykTfhT5pY6YtGTi7CQ>