Should we have to adjust the swappiness value in 2018?

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
sdet00

Should we have to adjust the swappiness value in 2018?

Post by sdet00 »

Hey guys, got a quick question here in regards to "swappiness". I have Linux Mint 18.3 64bit on a few PCs. One has 2GB RAM, one has 3GB RAM, and one has 6GB RAM. They all have SSDs, but occasionally I'll refurbish an old PC with Linux Mint which has an older hard drive. I was wondering if it's still optimal to mess with swappiness values. If you're not sure what I'm referring to, it's here: https://sites.google.com/site/easylinuxtipsproject/3

Now, it says that the default swappiness value is 60, and bringing it down to 10 can yield performance improvements. When I tried this around 18 months ago, it definitely seemed like the case. That said, time has passed, and one of the things that I have noticed is that the moment your hit the RAM limit, performance comes to a crawl for around 30 seconds or so, which is not very pleasant. I dual boot Windows and I find that running out of RAM doesn't seem to be as punishing on the system with the way that swap is setup. Now I'm thinking that changing swappiness values perhaps wasn't ideal anymore on modern kernels (I typically run whatever is the latest).

I'm no expert in this field but if someone could let me know their thoughts in the matter I'd be very interested!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
kc1di
Level 18
Level 18
Posts: 8175
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Should we have to adjust the swappiness value in 2018?

Post by kc1di »

Hello sdet00 and Welcome to Linxu Mint Forums,

This is just my opinion others may disagree -- it all depends on the amount of ram your working with I find anything under 4 Gb adjusting the level will help anything over that threshold it will not make much difference after 4GB you will very seldom run out of ram unless your doing some quite heavy processing of files such as audio or video or heavy gaming. Good Luck.
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Should we have to adjust the swappiness value in 2018?

Post by catweazel »

sdet00 wrote: Sat Feb 24, 2018 3:13 am time has passed
And in that time, you're expectations and the uses for your equipment have chnaged and grown. That's where the difference is.
one has 6GB RAM
My phone has more RAM than that. The lagging is telling you that you're expecting too much from your equipment. Either an upgrade or reduced expectations are required.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
Pjotr
Level 24
Level 24
Posts: 20092
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Should we have to adjust the swappiness value in 2018?

Post by Pjotr »

sdet00 wrote: Sat Feb 24, 2018 3:13 am one of the things that I have noticed is that the moment your hit the RAM limit, performance comes to a crawl for around 30 seconds or so, which is not very pleasant.
If anything, you'd want the swappiness to be set even lower than 10, then.... Try 1. :wink:
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Sir Charles

Re: Should we have to adjust the swappiness value in 2018?

Post by Sir Charles »

I just came across a system add-on called Swapspace in the Software Manager. It seems that this would eliminate the need of having to allocate disk space to a swap partition when installing the system:
This system daemon for the Linux kernel aims to do away with the need for large, fixed swap partitions or swap files.

When installing a Linux-based system (invariably GNU/Linux) with Swapspace, the usual swap partition can be omitted, or it can be kept quite small. Whenever Swapspace finds during normal system usage that more virtual memory is needed, it will automatically claim space from the hard disk. Conversely, swap space that is no longer needed is freed up again for regular use by the filesystem.

This means that with Swapspace installed, sizing the system's available swap space during installation is no longer a life-or-death choice. It now becomes practical to run GNU/Linux off just a single, big partition--with no disk space lost to regrettable installation choices. The system should also be able to handle the occasional memory-intensive task that takes much more swap space than was originally foreseen, without leaving the same swap space unused and unusable during normal operation as is normally the case.
source: http://pqxx.org/development/swapspace
Has anyone any experience with this? Would be nice to know how it works.
User avatar
CaptainKirksChair
Level 4
Level 4
Posts: 456
Joined: Sat Feb 18, 2017 9:29 pm

Re: Should we have to adjust the swappiness value in 2018?

Post by CaptainKirksChair »

Remember that the swap space is not just used for on-disk RAM. If you have hibernation enabled (usually with laptops) then the swap space is used when the computer hibernates. So if your laptop has 4gb of RAM with hibernation enabled, your swap partition should be 9gb; double the RAM plus a bit extra. The reason is that if RAM is swapped to disk and you hibernate the computer, it needs all that partition space to hibernate safely. And if your laptop battery is running out of juice and you can't get to it in time for a graceful shutdown, Mint will fall into hibernation. Again, you need that partition space.

As for swappiness, I never change mine -- ever. It is set to 60 by default and I leave it there. I have no problems with any of my Mint computers. A laptop with 4gb of RAM, two PC desktops with 8gb, and an iMac 9.1 with 8gb of RAM. They all work flawlessly on Mint Cinnamon 18.2 or 18.3. I have never noticed any performance degradation.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Should we have to adjust the swappiness value in 2018?

Post by catweazel »

CaptainKirksChair wrote: Sat Feb 24, 2018 6:01 pm your swap partition should be 9gb; double the RAM plus a bit extra.
1 x RAM + a little extra is sufficient.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
kc1di
Level 18
Level 18
Posts: 8175
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: Should we have to adjust the swappiness value in 2018?

Post by kc1di »

Double the ram was the old standard but a space = to ram is now sufficient. in any event a max of 4 gbs is enough for most machines.
Easy tips : https://easylinuxtipsproject.blogspot.com/ Pjotr's Great Linux projects page.
Linux Mint Installation Guide: http://linuxmint-installation-guide.rea ... en/latest/
Registered Linux User #462608
Jim Hauser

Re: Should we have to adjust the swappiness value in 2018?

Post by Jim Hauser »

I have 16 GB memory and swap set for 18 GB for hibernate. I always set swappiness at 10 because it is an old habit. Since upgrading to the 16 GB memory swap has never been used on this system as far as I know.
Locked

Return to “Other topics”