LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-05-2019, 03:59 PM   #1
MirceaKitsune
Member
 
Registered: May 2009
Distribution: Manjaro
Posts: 156

Rep: Reputation: 1
Should swappiness be lowered for SWAP partitions on SSD's?


As the results I found on this are inconclusive, I wanted to bring up the question here as well just to hear an extra opinion. I use an SSD for my root drive, with the SWAP partition being 4 GB large and the system having a total of 16 GB of RAM. Technically I don't even need SWAP with so much RAM, but just in case my RAM ever fills up I wanted to have a little safety margin. Although my SSD is a recent model and high quality MLC drive, I'm still on the lookout to avoid writing to it more than I need to, as to not wear out its relatively sensible lifespan. Although some openSUSE Tumbleweed snapshots can dump +1 GB of updates in one day (eg: game packages) my attention has been on SWAP as the default configuration causes it to be used very quickly.

The default swappiness is 60. What bothered me about it is that, whenever the system gets past roughly 6 GB of used memory, it begins filling the SWAP at once. With some software it can reach and stay at over 9 GB of RAM for a while, which in a few hours causes the SWAP to be filled up to 100 MB. This is pretty fast for barely exceeding half of my available RAM! As this makes rather nervous I decided to edit /etc/sysctl.conf and readd the commonly recommended vm.swappiness = 10 at the end.

Like I said I wanted to hear second thoughts just to know if this is the right approach: Do you believe the default swappiness of 60 is considered acceptable for SWAP partitions on SSD drives? Or do others agree that for an SSD a swappiness of 10 is better?
 
Old 12-05-2019, 05:26 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,131

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Such trivial swap usage is not a problem in itself - the swap rate is. If the data are out there and never referenced why do you care ?. There are also a bunch of virtual memory sysctls that affect memory management and hence swap. Screwing with them has more dramatic effect - some of which actually help occasionally.

FWIW I always use 1 for swappiness.
 
Old 12-05-2019, 05:56 PM   #3
MirceaKitsune
Member
 
Registered: May 2009
Distribution: Manjaro
Posts: 156

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
Such trivial swap usage is not a problem in itself - the swap rate is. If the data are out there and never referenced why do you care ?. There are also a bunch of virtual memory sysctls that affect memory management and hence swap. Screwing with them has more dramatic effect - some of which actually help occasionally.

FWIW I always use 1 for swappiness.
I'm mainly concerned about the overall writing: If every few days, after I restart my computer then run a memory intensive program, +50 MB are going to be written to the SWAP partition, that might be significant added over time. Especially as it's not all done at once, with a few MB likely deleted then others added every few minutes.
 
Old 12-05-2019, 07:39 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,993

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
I guess you could set up any number of ways to affect swap. Making raid swap or marking one swap over another if you have many mechanical drives to spare. I agree I'd look at exactly what you are holding in swap. For a test if you have enough ram then you can turn it off. It seems to me that a lot of programs will put a bit in swap even if enough ram exists.

Can look at MTBF for clues to how long this drive might last. I assume it will fail and by then a super duper ssd will be cheap.
 
Old 12-06-2019, 11:56 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,142

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
I don't consider a swappiness of 60 acceptable on any drive. As Jefro said, some things use swap quite unnecessarily so you want to control swap usage as much as possible. Reduce swappiness to 5, or even turn it off. If you don't do things like editing long videos, you probably don't need it with so much RAM — check with the free command and see just how much you're actually using.

Also, it might be a good idea go to /etc/fstab and add noatime,nodiratime to the partition parameters.
 
  


Reply

Tags
drive, hardware, ssd, swap, swappiness



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multicast drops as data rate is "lowered"?????? MichaelFreedman Linux - Networking 0 07-17-2014 04:45 PM
Blackberry firm misses its lowered forecasts Jeebizz Linux - News 0 06-17-2011 09:03 AM
Skype 2.1.0.81 My voice come through LOWERED - like a psychopath calling... lesnakupa Linux - Software 3 02-03-2011 09:58 PM
[SOLVED] Should I move my Swap Partition from my SSD to the platter? skipf Linux - Hardware 2 12-05-2010 11:50 AM
LXer: Ubuntu 10.04 swap update: It's not an Xorg bug but too much 'swappiness' — and LXer Syndicated Linux News 0 04-28-2010 12:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration