MX using sawp when Ram is free ?  [Solved]

Message
Author
Touhami-Dz
Posts: 31
Joined: Mon Oct 25, 2021 8:37 pm

MX using sawp when Ram is free ?

#1 Post by Touhami-Dz »

Hello
so im trying to understand how Ram works to give people who have old pcs a precise answer on which linux distro suit them (DE/WM)
so i have been testing MX 21 on virtualbox wih those settings :
https://i.imgur.com/m4NrcjH.png
and this is the test , i noticed that when i give the OS 1.5 GB ram it saves some data on swap (SSD i beleive which makes the experience slow for HDD low system environement) so does this mean that 1.5 is not inaff ? does this mean that ram will slow down the PC ?

https://i.imgur.com/fiCWpNs.png
and it gets worst when i give the OS 1GB ( when i open youtube etc it saves more data into swap)
https://i.imgur.com/UggH7uf.png
and with 2 GB Ram it doesnt save any data to SWAP
the question is why in the 1.5 gb ram test the system is saving data into swap when there is still free space on RAM ? is this the kernel bad ram management in cases like this or it's something else ? and what if i run system without swap in 1 + 1.5 gb ram settings is it better in some cases to delete swap ?
for A pentium 4 (3.2 ghz) and (512 x 2 = 1 GB ram) what is going to make the experience better if i can only choose one is it upgrading to 2GB ram or to Quad core CPU with 1 GB ram ?
Thank u for reading
Last edited by Touhami-Dz on Wed Dec 29, 2021 11:41 am, edited 2 times in total.

User avatar
manyroads
Posts: 2657
Joined: Sat Jun 30, 2018 6:33 pm

Re: MX using sawp when Ram is free ?

#2 Post by manyroads »

Google provide many results such as this: https://www.tothenew.com/blog/understan ... -in-linux/

Perhaps you can glean what you require from these sites.
Pax vobiscum,
Mark Rabideau - ManyRoads Genealogy -or- eirenicon llc. (geeky stuff)
i3wm, bspwm, hlwm, dwm, spectrwm ~ Linux #449130
"For every complex problem there is an answer that is clear, simple, and wrong." -- H. L. Mencken

User avatar
MadMax
Posts: 483
Joined: Wed Aug 04, 2021 3:25 pm

Re: MX using sawp when Ram is free ?  [Solved]

#3 Post by MadMax »

Linux manages the usage of the swap file with the "swappiness" value which is represented as a number from 0 to 100. You will find a lot of results on Google when you look up that term.

In short, the lower the value, the less the kernel will use the swap file. 0 disables swap completely.

To look up the current setting, use

Code: Select all

cat /proc/sys/vm/swappiness
You can change the value during runtime and see if you like the effects.

Code: Select all

sudo sh -c 'echo 10 > /proc/sys/vm/swappiness'
To make it persistent, add the following line into /etc/sysctl.conf

Code: Select all

vm.swappiness = 10

From my experience, you want to set swappiness to a very low non-0 value on any desktop system. Using the swap usually comes with a huge performance penalty, so the system should try to avoid using it as long as possible. Of course, it also depends on the given usecase. I run all my Linux desktops with swappiness 1.
If it ain't broke, don't fix it.
Main: MX 23 | Second: Mint 22 | HTPC: Linux Lite 7 | VM Machine: Debian 12 | Testrig: Arch/FreeBSD 14 | Work: RHEL 8

User avatar
oops
Posts: 1891
Joined: Tue Apr 10, 2018 5:07 pm

Re: MX using sawp when Ram is free ?

#4 Post by oops »

MadMax wrote: Sat Jan 01, 2022 8:12 am ... I run all my Linux desktops with swappiness 1.
... I run all my Linux desktops with swappiness 5 or 10, if HDD (1 is probably better for SSD). And vfs_cache_pressure 50 instead 100.
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
dolphin_oracle
Developer
Posts: 22099
Joined: Sun Dec 16, 2007 12:17 pm

Re: MX using sawp when Ram is free ?

#5 Post by dolphin_oracle »

mx 21 sets the default to swappiness to 15.

Code: Select all

cat /etc/sysctl.d/99-swappiness_mx.conf 
vm.swappiness = 15
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
oops
Posts: 1891
Joined: Tue Apr 10, 2018 5:07 pm

Re: MX using sawp when Ram is free ?

#6 Post by oops »

dolphin_oracle wrote: Sat Jan 01, 2022 3:07 pm mx 21 sets the default to swappiness to 15.

Code: Select all

cat /etc/sysctl.d/99-swappiness_mx.conf 
vm.swappiness = 15
... Yes it's the right place for the changes (even into MX19) ... 15 instead 60 by default is fine too for a desktop (not a server).
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

jodumont
Posts: 7
Joined: Thu Jun 27, 2019 10:29 am

Re: MX using sawp when Ram is free ?

#7 Post by jodumont »

Touhami-Dz wrote: Wed Dec 29, 2021 6:56 am the question is why in the 1.5 gb ram test the system is saving data into swap when there is still free space on RAM ? is this the kernel bad ram management in cases like this or it's something else ? and what if i run system without swap in 1 + 1.5 gb ram settings is it better in some cases to delete swap ?

for A pentium 4 (3.2 ghz) and (512 x 2 = 1 GB ram) what is going to make the experience better if i can only choose one is it upgrading to 2GB ram or to Quad core CPU with 1 GB ram ?
Thank u for reading
As I consider, others gave you a pretty good hint to figure out why you have this behavior (vm.swappiness), I just want to say the type of CPU you have will not change anything on that, but yes adding RAM will help you in anycase to perceive a better experience; if I were you I would look to boost it at least with 4GB or RAM.

BTW: this is not a kernel bad RAM management, it's a choice made by MX Team, which in most of the case will be a pretty smart one.

User avatar
MadMax
Posts: 483
Joined: Wed Aug 04, 2021 3:25 pm

Re: MX using sawp when Ram is free ?

#8 Post by MadMax »

Ah, I did not know there were dedicated config files for sysctl.d in MX Linux. That's pretty neat.

I usually go straight into /etc/sysctl.conf after any fresh Linux install. I will keep that in mind.
If it ain't broke, don't fix it.
Main: MX 23 | Second: Mint 22 | HTPC: Linux Lite 7 | VM Machine: Debian 12 | Testrig: Arch/FreeBSD 14 | Work: RHEL 8

Post Reply

Return to “Software / Configuration”