What's your swappiness set to, eh?

For interesting topics. But remember this is a Linux Forum. Do not post offensive topics that are meant to cause trouble with other members or are derogatory towards people of different genders, race, color, minors (this includes nudity and sex), politics or religion. Let's try to keep peace among the community and for visitors.

No spam on this or any other forums please! If you post advertisements on these forums, your account may be deleted.

Do not copy and paste entire or even up to half of someone else's words or articles into posts. Post only a few sentences or a paragraph and make sure to include a link back to original words or article. Otherwise it's copyright infringement.

You can talk about other distros here, but no MX bashing. You can email the developers of MX if you just want to say you dislike or hate MX.
Message
Author
skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: What's your swappiness set to, eh?

#41 Post by skidoo »

Instead of manually editing the conf file, you can add (append) via

Code: Select all

sudo echo "vm.swappiness = 10" >> /etc/sysctl.conf
(10, or zero, or whatever value you choose)

User avatar
Mauser
Posts: 1350
Joined: Mon Jun 27, 2016 7:32 pm

Re: What's your swappiness set to, eh?

#42 Post by Mauser »

skidoo wrote:Instead of manually editing the conf file, you can add (append) via

Code: Select all

sudo echo "vm.swappiness = 10" >> /etc/sysctl.conf
(10, or zero, or whatever value you choose)
I don't understand.
I am command line illiterate. :confused: I copy & paste to the terminal. Liars, Wiseguys, Trolls, and those without manners will be added to my ignore list. :mad:

Kestrel
Posts: 23
Joined: Sat Sep 23, 2017 8:52 pm

Re: What's your swappiness set to, eh?

#43 Post by Kestrel »

Mauser you say you read the following link which I posted earlier in this thread.

https://sites.google.com/site/easylinux ... swappiness

It explains it pretty simply. Anyone with 4gb of ram or more need not bother decreasing the swappiness as their systems will seldom use the swap partition anyway. I have not bothered decreasing it in MX because I have 8gb ram but I did decrease it to 1 when I only had 3gb of ram so that my system would use the swap partition only when absolutely necessary, the higher value your swappiness is set to the more your system will tend to use the swap partition rather than the ram.

Skidoo is telling you how to change the swappiness figure in the file via the command line rather than actually opening the file in an editor. The sudo command enables you to edit that file as root from the command line without you needing to manually go to the file, but it seems from your earlier posts you have been manually navigating to the file in a file browser and trying to edit it that way.
Dell Inspiron 530 Desktop
8gb DDR2 RAM @ 800mhz
Intel® Core™2 Duo Processor E8600 3.33 GHz
MX-21.3

User avatar
Richard
Posts: 1577
Joined: Fri Dec 12, 2008 10:31 am

Re: What's your swappiness set to, eh?

#44 Post by Richard »

How to set swappiness, 2 p's & 3 s's

# Read current setting:
$ cat /proc/sys/vm/swappiness
# returns current, default=60

# change value for this session, as root:
echo 50 > /proc/sys/vm/swappiness
# then, to verify;
cat /proc/sys/vm/swappiness
# should return 50


If convinced it can be made permanent.

# to change permanently:
# open Thunar
# navigate to /etc/sysctl.conf
# the file, not the folder
# highlight the file, right click, Edit as Root
# scroll to end of file, add the following
# line to the end of file,
# before exit, if it exists,l
# as follows (for SSD)
vm.swappiness=1

# test with
cat /proc/sys/vm/swappiness
# if it doesn't indicate the changed value,
# then probably have to reboot to read in
# the new value
# I don't remember if I actually checked. again.
# my T430 with small SSD, running with
# vm.swappiness=1

# if correct or satisfied, then
# reboot and test again with
cat /proc/sys/vm/swappiness
# should return the value you entered.
Last edited by Richard on Thu Feb 15, 2018 12:13 am, edited 1 time in total.
Thinkpad T430 & Dell Latitude E7450, both with MX-21.3.1
kernal 5.10.0-26-amd64 x86_64; Xfce-4.18.0; 8 GB RAM
Intel Core i5-3380M, Graphics, Audio, Video; & SSDs.

User avatar
Mauser
Posts: 1350
Joined: Mon Jun 27, 2016 7:32 pm

Re: What's your swappiness set to, eh?

#45 Post by Mauser »

I got it to change. :) At first sudo echo "vm.swappiness = 10" >> /etc/sysctl.conf didn't work after I checked it. Then I went to do it as Richard said and found it was change already. Then I conformed it in the terminal. Mine is set to 10 now. :) Thank you everyone.
I am command line illiterate. :confused: I copy & paste to the terminal. Liars, Wiseguys, Trolls, and those without manners will be added to my ignore list. :mad:

User avatar
Protokol
Posts: 18
Joined: Fri Apr 13, 2018 10:46 am

Re: What's your swappiness set to, eh?

#46 Post by Protokol »

Hello,

I have an old asus laptop (10 years old) 32 bits with 2 gb of ram and a ssd disk
my actual swappiness settings are :
vm.swappiness = 90
vm.overcommit_memory = 0
vm.overcommit_ratio = 90

What do you think of it? is it a good settings? maybe a way to optimize it?
Hewlett-Packard Compaq Presario CQ71 Notebook
Kernel: 4.19.0-12-amd64 x86_64
Desktop: MX-19.2_x64 patito feo May 31 2020
Graphics: Intel Mobile 4 Series Integrated Graphics
Ram : 4GB

User avatar
stsoh
Posts: 183
Joined: Sun Aug 20, 2017 10:11 am

Re: What's your swappiness set to, eh?

#47 Post by stsoh »

dont tweak overcommit, set at default.
run zram and zswap, set swappiness=100.
https://mxlinux.org/wiki/other/zram

Code: Select all

$ dmesg|grep swap
[    0.600060] zswap: loaded using pool lzo/zbud
[    2.515565] Adding 2033776k swap on /dev/zram0.  Priority:100 extents:1 across:2033776k SSFS
[    2.525206] Adding 2033776k swap on /dev/zram1.  Priority:100 extents:1 across:2033776k SSFS
Last edited by stsoh on Wed May 02, 2018 5:46 am, edited 1 time in total.
MX-17.1_x64 Horizon, G41M-P33 Combo (MS-7592), Pentium E5400 (2706 MHz), 8Gb RAM (984 MT/s),
Intel 4 Series Integrated Graphics, Realtek PCIe Fast RTL8101/2/6E, PCI Gigabit RTL8169 Ethernets.
Accepted Linux when i found MX-Linux in 2016.

User avatar
cyrilus31
Posts: 629
Joined: Thu Nov 03, 2016 3:24 pm

Re: What's your swappiness set to, eh?

#48 Post by cyrilus31 »

Protokol wrote:Hello,

I have an old asus laptop (10 years old) 32 bits with 2 gb of ram and a ssd disk
my actual swappiness settings are :
vm.swappiness = 90
vm.overcommit_memory = 0
vm.overcommit_ratio = 90

What do you think of it? is it a good settings? maybe a way to optimize it?
Default vm.swappiness value is 60. 90 means that you swap when 90% of your ram is left. You should change this value to 10 instead.
As for your other entries, I don't know and will wait to see if I can tweak more my install :happy:

User avatar
fehlix
Developer
Posts: 10303
Joined: Wed Apr 11, 2018 5:09 pm

Re: What's your swappiness set to, eh?

#49 Post by fehlix »

This about the command you tried

Code: Select all

sudo echo "vm.swappiness = 10" >> /etc/sysctl.conf
Well the correct command line would read like this

Code: Select all

sudo sh -c 'echo "vm.swappiness = 10" >> /etc/sysctl.conf'
Spott the difference!
The redirect '>>' running in the user context of the first command will fail due to permssion error.
A nice liitle alternative:

Code: Select all

echo "vm.swappiness = 10" | sudo tee -a /etc/sysctl.conf 
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

User avatar
Protokol
Posts: 18
Joined: Fri Apr 13, 2018 10:46 am

Re: What's your swappiness set to, eh?

#50 Post by Protokol »

Thanks to all, I will test and see what happens...
Hewlett-Packard Compaq Presario CQ71 Notebook
Kernel: 4.19.0-12-amd64 x86_64
Desktop: MX-19.2_x64 patito feo May 31 2020
Graphics: Intel Mobile 4 Series Integrated Graphics
Ram : 4GB

Post Reply

Return to “General”