What is swappiness ?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
wannabelinuxuser

What is swappiness ?

Post by wannabelinuxuser »

Code: Select all

cat /proc/sys/vm/swappiness
60

Code: Select all

cat /proc/sys/vm/swappiness
10
Does this really improve the system performance ?

I have changed it from 60 to 10, but it doesn't feel like I have got some performance boost. :roll:
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
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: What is swappiness ?

Post by catweazel »

wannabelinuxuser wrote: Mon Apr 16, 2018 2:26 am I have changed it from 60 to 10, but it doesn't feel like I have got some performance boost. :roll:
That would be because the setting isn't a performance boost setting per se.

Swappiness defines how how often the kernel will copy RAM to swap. The lower the number, the less the kernel will swap. If you don't see any difference then you're not doing anything that would cause the kernel to want to swap.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
User avatar
jimallyn
Level 19
Level 19
Posts: 9075
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: What is swappiness ?

Post by jimallyn »

It will improve performance on computers that don't have a lot of RAM. I have verified that on a couple of old laptops. My desktop computer has 12 GB of RAM, and changing swappiness makes no difference on that.
“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan
michael louwe

Re: What is swappiness ?

Post by michael louwe »

Last edited by michael louwe on Mon Apr 16, 2018 12:26 pm, edited 1 time in total.
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: What is swappiness ?

Post by Cosmo. »

On most current systems swappiness is snake oil.
User avatar
kc1di
Level 18
Level 18
Posts: 8146
Joined: Mon Sep 08, 2008 8:44 pm
Location: Maine USA

Re: What is swappiness ?

Post by kc1di »

if you have more than 4 Gbs of Ram you will in normal use not be using the swap partition/file much so the setting will have minimal or no affect on speed.
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
Hoser Rob
Level 20
Level 20
Posts: 11806
Joined: Sat Dec 15, 2012 8:57 am

Re: What is swappiness ?

Post by Hoser Rob »

Cosmo. wrote: Mon Apr 16, 2018 5:19 am On most current systems swappiness is snake oil.
I agree with this, though I'd use the word 'overrated'. Lowering it is no magic cure for sluggishness. Also, I think it's rather interesting how many people think they know better than the Ubuntu devs. I'm not saying you should necessarily leave it at the default value but some experimenting should be done.

As pointed out, all swappiness really does is set how full your RAM is before using swap. If you set it too low it'll stilll swap but less often. When it does happen you'll feel like your system has hit a brick wall.

My 1Gb netbook actually runs fastest with swappiness set to 40.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: What is swappiness ?

Post by Cosmo. »

Snake oil is indeed hard word. But seeing, how often changing this setting is given as a solution against slow system or as a prevention against slowness, even without taking a look, if swap gets used at all, I come to no other conclusion, that it gets offered as such.
Faust

Re: What is swappiness ?

Post by Faust »

Hoser Rob wrote: Mon Apr 16, 2018 6:45 am
Cosmo. wrote: Mon Apr 16, 2018 5:19 am On most current systems swappiness is snake oil.
I agree with this, though I'd use the word 'overrated'. Lowering it is no magic cure for sluggishness. ........
That's a good concise summary of this topic .

I've got swappiness set at 10 on all my Linux rigs and Conky shows that it NEVER gets used .
But for anyone doing resource-hogging activities ( eg. editing video files ) all bets are off .... it's a different story
... you may benefit from more swappiness to avoid hitting that performance wall .

For users more familiar with Windows systems , M$ call this pagefile.sys , and by default it is set to be equal to the amount of installed RAM ,
which is excessive , IMO .
Wompoo
Level 6
Level 6
Posts: 1116
Joined: Sat Dec 28, 2013 2:42 am

Re: What is swappiness ?

Post by Wompoo »

Faust wrote: Mon Apr 16, 2018 7:48 am .................................. Conky shows that it NEVER gets used .
.................................................
How do you use conky? Can you explain please?
I did a search. When I ask this question in a search engine, multiple sites are offered explaining how to install conky and not how to use it.

Edit: I realise this is a question for another thread. Apologies etc.
Last edited by Wompoo on Sat Apr 21, 2018 1:15 am, edited 1 time in total.
Desktop PC #1
Linux Mint 20.3 MATE desktop (64-bit), Asus
ASUSTeK model: P5G41T-M LX, 8 Gb RAM
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: What is swappiness ?

Post by majpooper »

I guess swap is useful for old machines with hardly any RAM - I have 16G of RAM and no longer (~2 years) configure a swap partition. It really depends on what you have and how you use your rig. So experimenting is the best way to figure out what is optimum. I set swapoff for so long with no adverse results that the last few fresh installs of 17.x and 18.x I opted out of wasting memory on SWAP.
Faust

Re: What is swappiness ?

Post by Faust »

Since my previous post , I decided to test this further .

I started booting VMs , one after another and I got to 4 running with no swap being used .
After the fifth one , a few hundred Meg of swap action showed up ....
so when I said " Never " , I should have said " Rarely " .... :)

@Wompoo I only just noticed your question , and yes , a new thread is probably best , but certainly no apology necessary :D
BTW - I typed "Conky" into the search box ( top right ) and there seems to be plenty of stuff to read on here
Jan253

Re: What is swappiness ?

Post by Jan253 »

Hello everyone,

(I am a newby... perhaps is the 1st thing i should mention)

-- As I proceed to set this SWAPPINESS, through: xed admin:///etc/sysctl.conf , then I got this message popping in front of me:
---> "IMPOSSIBLE TO OPEN THE " admin///etc/sysctl/conf. " FILE (here in my attachment )
..then, the only way to get out is to press "cancel"

What is it?

-- And on the Terminal command, it says that the " xed admin:///etc/sysctl.conf" is not supported

So, do BIG PROBLEM here ??

What shall I do

I was simply following the "10 things to do first in Linux Mint 19 Cinnamon", here:
https://sites.google.com/site/easylinux ... AL-ACTIONS:

(When i say "newby" it is really "newby", started Linux +/- 2 months ago; but mostly I am not a tech person..)

THANK YOU for any possible support you might find useful
Jan (previously alaska253, but user/password couple doesn't work anymore, it's not a password loss. For some reason i ignore I cannot log in)
md419
Level 2
Level 2
Posts: 93
Joined: Thu Sep 22, 2011 2:34 pm

Re: What is swappiness ?

Post by md419 »

Jan253 wrote: Fri Jun 08, 2018 4:48 pm Hello everyone,

(I am a newby... perhaps is the 1st thing i should mention)

-- As I proceed to set this SWAPPINESS, through: xed admin:///etc/sysctl.conf , then I got this message popping in front of me:
---> "IMPOSSIBLE TO OPEN THE " admin///etc/sysctl/conf. " FILE (here in my attachment )
..then, the only way to get out is to press "cancel"
There's a slight typo on this page. If you look at this webpage (it's the same site, but just a different page) https://sites.google.com/site/easylinux ... swappiness, you'll see the actual command is

Code: Select all

gksudo xed /etc/sysctl.conf
to correctly open the editor.
User avatar
TursonX
Level 3
Level 3
Posts: 116
Joined: Thu May 26, 2016 1:36 am

Re: What is swappiness ?

Post by TursonX »

Hi.
I think, the hard disk HDD makes less noise.
Maybe, I don't notice another difference.

I currently in 10. Do you suggest trying another value?
LM 18 Mate x64 » kernel 4.4.0-165-generic » MSI 760GM-P34 » video onboard Ati Radeon HD 3000 » AMD Athlon II X2 240 » 4GB RAM ddr3 hynix » HDD WD Sata II
Jlvs2run
Level 3
Level 3
Posts: 146
Joined: Wed Sep 16, 2015 11:16 pm

Re: What is swappiness ?

Post by Jlvs2run »

md419 wrote: Sun Jun 10, 2018 4:15 pm There's a slight typo on this page.
the actual command is

Code: Select all

gksudo xed /etc/sysctl.conf
to correctly open the editor.
This worked fine for me. With 3gb ram, the swappiness now is at 10.

Thank you!
LM 18.3 xfce / lenovo T520 / 8gb ram / 240gb ssd
LM 18.3 xfce / biostar a870u3 / amd athlon II x2 250 / 8gb ram / nvidia gt218 geforce 210 /
Locked

Return to “Beginner Questions”