Gavin W. Burris on 12 Jul 2015 07:27:55 -0700


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

Re: [PLUG] swappiness and ssd


I tend to trust the documentation that Red Hat releases.  Note that the
latest 3.5+ kernels have different behavior.  Where 0 was previously
used, 1 is now recommended.  This change has also been back-ported to
2.6 kernels.

https://en.wikipedia.org/wiki/Swappiness#cite_note-2

Cheers.

On Sat 07/11/15 12:08PM -0400, Keith C. Perry wrote:
> Not sure I agree with Red Hat's assessment of swappiness = 0. The point is to aggressively not swap . This reminds me why Rich Freeman (errr, Prime) and I had similar ideas behind why we leave it off. For me, this sort of "tuning" doesn't directly command behavior or define a policy. So whether 0, 1, 5, or 30, I'm not really telling the kernel directly to, for example: 
> 
> swap only if I am about to run out of memory (e.g. under 1Mb while under memory pressure) 
> start swapping memory when system usage is under 50% 
> start swapping memory when user consumption is over 50% 
> stop swapping and return everything to main memory if I will have more that 30% free when done 
> 
> You get the idea. 
> 
> That said, I feel like I might have hijacked K.S.'s update in regards to swapping on SSD's. Putting aside log-structured file systems which are generally better for SSD use, shouldn't swappiness be turned down on SSD's generally? Doesn't a swappiness of 80 mean you are swapping more than when the system is set to 60? 
> 
> Also, if that is the case, does that imply you have to run fstrim more? 
> 
> I'm an XFS user and thankfully realtime discarding is available if I am ok with the performance penalty and I don't want to use batch mode. Something to remember for my next server build which will use an SSD for the system drive. 
> 
> http://xfs.org/index.php/FITRIM/discard 
> 
> 
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 
> Keith C. Perry, MS E.E. 
> Owner, DAO Technologies LLC 
> (O) +1.215.525.4165 x2033 
> (M) +1.215.432.5167 
> www.daotechnologies.com 
> 
> 
> From: "Gavin W. Burris" <bug@wharton.upenn.edu> 
> To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org> 
> Sent: Saturday, July 11, 2015 9:30:14 AM 
> Subject: Re: [PLUG] swappiness and ssd 
> 
> Is 0 really sane? It was my understanding that swappiness=0 was too 
> aggressive, almost disables swap all-together. Setting swappiness=1 may 
> be better, only swapping to avoid the OOM. This, and keeping just a few 
> gigs of swap as a last-ditch protection, provides a metric to monitor 
> and avoid. 
> 
> Big fat warning here, on the Performance Tuning Guide: 
> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Performance_Tuning_Guide/sect-Red_Hat_Enterprise_Linux-Performance_Tuning_Guide-Memory-Configuration_tools.html#sect-Red_Hat_Enterprise_Linux-Performance_Tuning_Guide-Configuration_tools-Configuring_system_memory_capacity 
> 
> Cheers. 
> 
> 
> On Fri 07/10/15 09:24PM -0400, Rich Mingin (PLUG) wrote: 
> 
> 
> Not at all. It's the default I had recommended to me by the Arch wiki, some 
> knowledgeable friends, and I think also Rich Prime. It works for me, though 
> I still have an issue where VMware stalls my whole machine for 5-30 seconds 
> every 3-5 minutes if I don't manually disable khugepaged defrag. Ah well. 
> 
> On Fri, Jul 10, 2015 at 9:10 PM, Keith C. Perry <kperry@daotechnologies.com> 
> wrote: 
> 
> > Ahh so swappiness=0 is not a weird setting. 
> > 
> > --- 
> > KP- 
> > 
> > On Jul 10, 2015 9:05 PM, "Rich Mingin (PLUG)" <plug@frags.us> wrote: 
> > > 
> > > I was declining to post, but I'll just chime in, I'm also swappiness=0 
> > on my machines. The two that touch VMs have 32GB of ram, SSDs, and a small 
> > swap file on some spinning rust, so I get all of the benefits listed, 
> > without unneeded SSD wear. 
> > > 
> > > On Fri, Jul 10, 2015 at 8:46 PM, Rich Freeman <r-plug@thefreemanclan.net> 
> > wrote: 
> > >> 
> > >> On Fri, Jul 10, 2015 at 6:31 PM, Keith C. Perry 
> > >> <kperry@daotechnologies.com> wrote: 
> > >> > 
> > >> > Rich Freeman, you and I both leave off for similar reasons. Did you 
> > know 
> > >> > about this? Looks like a lower setting (like 0 LOL) might get swap 
> > to 
> > >> > perform in a "sane" way. 
> > >> > 
> > >> 
> > >> I've never really been satisfied with it, even with a swappiness of 0. 
> > >> 
> > >> -- 
> > >> 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 
> > > 
> > > 
> > ___________________________________________________________________________ 
> > 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 
> > 
> 
> ___________________________________________________________________________ 
> 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 
> 
> 
> 
> 
> 
> -- 
> Gavin W. Burris 
> Senior Project Leader for Research Computing 
> The Wharton School 
> University of Pennsylvania 
> ___________________________________________________________________________ 
> 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 

> ___________________________________________________________________________
> 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


-- 
Gavin W. Burris
Senior Project Leader for Research Computing
The Wharton School
University of Pennsylvania
___________________________________________________________________________
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