Rich Freeman on 21 Jun 2014 08:00:54 -0700


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

Re: [PLUG] How much swap do you need?


On Sat, Jun 21, 2014 at 10:24 AM, Keith C. Perry
<kperry@daotechnologies.com> wrote:
>
> One of my most used systems is an older laptop with only 2Gb of RAM so
> I use a 2Gb swap file.  After about 7 to 10 days of having browsers
> with lots of tabs open, using VM's and a large Java app what I end
> up doing is closing the browser and as many items as I can so that
> used swap will fit in free RAM.  Then I bounce the swap (swapoff then
> swapon) to force everything back into main memory.  If you don't want
> to or can't shutdown your VMs I've found this method does a decent job
> of refreshing memory.

I used to do the same occasionally when I had swap.  The fact that it
helps at all just demonstrates in my mind that the Linux swap
algorithms aren't as good as they should be.  The kernel should be
keeping stuff that is likely to be accessed in RAM, whether that is
processes, or cache, or whatever.

By cycling your swap you dumped a bunch of cache, and if Linux was
doing its job properly that would slow your system down.

Stuff like updatedb running in cron doesn't help things.  As far as I
can tell, few of these applications use fadvise to tell the kernel
that they are one-time scans that shouldn't wipe/flood the cache.
Properly-written software can go a long way to improving the
performance of linux's cache/buffering/etc algorithms (should I get on
my soap box about how mythtv's constant fsyncs kill RAID
performance?).

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug