How to reduce swapiness in manjaro linux

swap

#1

How do I reduce swapiness


#2

Have a look here:
https://wiki.archlinux.org/index.php?title=Swap&redirect=no#Swappiness


#3

Placing more RAM also helps. I have 32GB of RAM and no swap space whatsoever. Manjaro Xfce works very snappy on my machine, as responsive as an iPhone. Love it.

Manjaro plus lots of RAM is delicious.


#4

The file which used to define vm.swappiness on Manjaro is /etc/sysctl.d/100-manjaro.conf
Maybe this changed in the new release…


#5

Lots of RAM is always delicious.

I have 32 GB of RAM too, but I still use swap: zswap, e.g. compressed swap in RAM.
Here are my VM settings, in /etc/sysctl.d/100-manjaro.conf:

vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
vm.dirty_expire_centisecs = 2000
vm.dirty_writeback_centisecs = 1000
vm.swappiness = 20
vm.vfs_cache_pressure = 70

#6

There is no “/etc/system…” on my machine!

$ cd /etc/s
samba/             securetty          sensors.d/         shadow-            slsh.rc            speech-dispatcher/ sudoers            sysctl.d/          
sane.d/            security/          services           shells             smartd.conf        ssh/               sudoers.d/         systemd/           
sbackup.conf       sensors3.conf      shadow             skel/              sound/             ssl/               sysconfig/       

So “sysctl”?


Found it in:
/etc/sysctl.d/100-manjaro.conf


#7

vm.swappiness is in a file within the /etc/sysctl…d/ directory. the file name keeps changing. just look through all the files in this directory. some file should already contain the vm.swappiness setting. edit it.


#8

typo corrected, thanks and sorry!


#9

i have 6.9GB of ram and my pc never uses swap


#10

Be carefull!

Some programs expect SWAP - and can do crazy things if it is not there…

Todays size and price of a SSD makes it very easy to create and set at least a 1 GB SWAP partition on the SSD.
And no worries about (the maybe happening) a lot writings on the SSD:
SSD endurance myths and legends
The SSD Endurance Experiment: They’re all dead


#11

use

cat /proc/sys/vm/swappiness

to see what it is … I believe it is “1” by default.

… and why not use “/etc/sysctl.d/99-sysctl.conf” ?


#12

it most certainly is not 1 by default

it is 60

use a .conf file as suggested with

vm.swappiness=10

this is very much usable on a system on SSD and with 32GB of ram

adjust to your system accordingly

BUT assigning SWAP is something about adjusting your RAM and HD in an approitate relation between the swappiness (when does swap occur), the disk space assigned to SWAP and if what kind of harddrive you’re using (eg. SSD)


#13

It’s was the default settings of manjaro until recent iso. There was /etc/systemctl.d/100-manjaro.conf
That was setting wm.snappiness = 1

It’s not the case anymore.


#14

I know - you made me aware - most recently


#15

yes.

it was changed, because a swappiness of 1 means your system becomes unresponsive when it starts to swap until it has finished swapping. this is bad.
with a swappiness of 10 your system starts to swap earlier but it should not become totally unresponsive.


#16

my recomendation is solely based on my system.

please see the vm.swappiness=10 as workable recommendation if your system is on SSD. When on ATA or SATA you will need to adjust the value accordingly.

My system in running - very nerdly - entirely on SSD and as such cannot be seen as a general recommendation


#17

That’s possibly true, but what programs exactly expect swap?

You obviously haven’t done heavy workloads yet :slight_smile:


#18

Like compiling a kernel and a browser simultaneously?
BTW: I am able to compile a kernel in TTY with tmpfs set to size=3.6GB without touching the SSD.


#19

…while at the same time having a browser with 10 tabs open, plus video playback on one screen, and a game on the other? :slight_smile: Just kidding.

Kernels don’t use that much RAM while being compiled. Even Firefox still fits in RAM.
Next step would be to try to compile AOSP and looking at RAM usage.


#20

[quote=“torvic, post:17, topic:12245”]
i have 6.9GB of ram and my pc never use

You obviously haven’t done heavy workloads yet :slight_smile:
[/quote]yes but it is enough to do 10% of heavy workload if you know what i mean :imp: