Swappiness change

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
toolrick

Swappiness change

Post by toolrick »

Dear Forum,

I havetried to adjust the swapiness in my linux mint XFCE 18.3, from 60 to 30; but the problem is that when I open the Task Manager it appears the same amount of memory available, 1.9gb. Here is the information for code:

Code: Select all

 ~ $ inxi -pou
Partition: ID-1: / size: 27G used: 8.9G (36%) fs: ext4 dev: /dev/mmcblk0p2
           uuid: 566d8e79-1bb7-48b0-a216-76d4dc1007fb
           ID-2: /boot/efi size: 511M used: 1.2M (1%) fs: vfat dev: /dev/mmcblk0p1
           uuid: 9727-FC69
           ID-3: swap-1 size: 2.03GB used: 0.37GB (18%) fs: swap dev: /dev/mmcblk0p3
           uuid: f7e47644-3aad-4dfe-bbad-72b4077f50c0
Unmounted: ID-1: /dev/mmcblk0 size: 31.27G label: N/A uuid: N/A
           ID-2: /dev/mmcblk0boot1 size: 0.00G label: N/A uuid: N/A
           ID-3: /dev/mmcblk0boot0 size: 0.00G label: N/A uuid: N/A
           ID-4: /dev/mmcblk1 size: 16.02G label: N/A uuid: N/A
           ID-5: /dev/mmcblk1p1 size: 16.02G label: ESD-USB uuid: 9667-D7FF
My question is if you can change the amount of memry available and if mine it's ok to solve most issues when oppening too many windows and apps at the same time.

Thanks,

RD
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.
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Swappiness change

Post by Laurent85 »

Post below command output:

Code: Select all

inxi -b
free -h
sysctl vm.swappiness
Image
User avatar
jimallyn
Level 19
Level 19
Posts: 9075
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: Swappiness change

Post by jimallyn »

You can change swappiness as described here:

https://sites.google.com/site/easylinux ... emory-RAM-


That will NOT change the amount of RAM you have available. But additional RAM modules can be added to most computers.
“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
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: Swappiness change

Post by majpooper »

To my understanding swappiness does not change how big your SWAP partition is. Rather swappiness controls when your system uses your swap partition.
Sir Charles

Re: Swappiness change

Post by Sir Charles »

Swappiness is the kernel parameter that defines how much (and how often) your Linux kernel will copy RAM contents to swap. This parameter's default value is “60” and it can take anything from “0” to “100”. The higher the value of the swappiness parameter, the more aggressively your kernel will swap.
https://www.howtoforge.com/tutorial/linux-swappiness/
MScott

Re: Swappiness change

Post by MScott »

Hi toolrick

As has already been mentioned, the size of your swap file/partition (2GB, 4GB, 6GB, etc) is different from how often (frequent) data is written (60, 30, 10, etc). You might say it can be compared to a 2 gallon, 4 gallon, or 6 gallon fuel tank, and at what rate it gets emptied, 10 minutes, 30 minutes, 60 minutes.

More RAM added to your system, from 4GB to 8GB or 16GB should allow for a smaller swap size, from 4GB to maybe 2GB, and less frequent use, say from 60 to 30, or 10 in the swapiness... as an example :)

Hibernation is another issue...
toolrick

Re: Swappiness change

Post by toolrick »

Laurent85 wrote: Mon Mar 26, 2018 3:58 pm Post below command output:

Code: Select all

inxi -b
free -h
sysctl vm.swappiness

Code: Select all

System:    Host: ricardo-HP-Stream-x360-Convertible-PC-11 Kernel: 4.13.0-37-generic x86_64 (64 bit)
           Desktop: Xfce 4.12.3 Distro: Linux Mint 18.3 Sylvia
Machine:   System: Hewlett-Packard product: HP Stream x360 Convertible PC 11 v: Type1 - ProductConfigId
           Mobo: Hewlett-Packard model: 802B v: 57.19
           Bios: Insyde v: F.07 date: 03/28/2017
CPU:       Dual core Intel Celeron N2840 (-MCP-) speed/max: 2165/2582 MHz
Graphics:  Card: Intel Atom Processor Z36xxx/Z37xxx Series Graphics & Display
           Display Server: X.Org 1.18.4 drivers: (unloaded: fbdev,vesa)
           Resolution: 1366x768@59.99hz
           GLX Renderer: Mesa DRI Intel Bay Trail GLX Version: 3.0 Mesa 17.2.8
Network:   Card-1: Broadcom BCM43142 802.11b/g/n driver: wl
           Card-2: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
           driver: r8169
Drives:    HDD Total Size: NA (-)
Info:      Processes: 188 Uptime: 4 min Memory: 1436.2/1881.4MB
           Client: Shell (bash) inxi: 2.2.35 

Code: Select all

              total        used        free      shared  buff/cache   available
Memoria:        1,8G        1,3G         63M        206M        451M        150M
Swap:          1,9G         61M        1,8G

Code: Select all

vm.swappiness = 30
toolrick

Re: Swappiness change

Post by toolrick »

MScott wrote: Tue Mar 27, 2018 3:28 am Hi toolrick

As has already been mentioned, the size of your swap file/partition (2GB, 4GB, 6GB, etc) is different from how often (frequent) data is written (60, 30, 10, etc). You might say it can be compared to a 2 gallon, 4 gallon, or 6 gallon fuel tank, and at what rate it gets emptied, 10 minutes, 30 minutes, 60 minutes.

More RAM added to your system, from 4GB to 8GB or 16GB should allow for a smaller swap size, from 4GB to maybe 2GB, and less frequent use, say from 60 to 30, or 10 in the swapiness... as an example :)

Hibernation is another issue...
Do you think with a swap partition of 2GB it's enough for my computer to work well? I have adjusted the swappiness to 30, since I tried to decrease it to 10, but started to work slower everytime I oppened few apps.
Do you think if I make a swap partition of at least 4GB that would make my compuer run faster?
Also how do I make the swap partition? It seems through the instalation it already made the partition at 2GB.

Thanks, RD.
Laurent85
Level 17
Level 17
Posts: 7081
Joined: Tue May 26, 2015 10:11 am

Re: Swappiness change

Post by Laurent85 »

I don't think you are affected by a memory constraint but rather limited by cpu / gpu hardware capabilities. 2 Gb of ram is enough for the Xfce desktop. Above output reports free ram still available for applications / processes.

Preferably set a swappiness value close to 10-30, high value increase OS tendency to swap. And swapping decrease the computer average performance.
Image
Hoser Rob
Level 20
Level 20
Posts: 11796
Joined: Sat Dec 15, 2012 8:57 am

Re: Swappiness change

Post by Hoser Rob »

As mentioned swappiness doesn't have anything to do with how much RAM you have, it decides when to write to swap depending on how much free RAM is availabe. See here:

https://help.ubuntu.com/community/SwapF ... ange_it.3F

Setting swappiness to 10 isn't correct for eveyone so I'd suggest playing aroung with that value. 10 or less may be too low for a 2 Gb machine. My 1G RAM netbook with MInt Xfce it runs best at 40. Interestingly this was the default Ubuntu.Mint swappiness value for a long time. I've never found the inode cache setting particularly useful so I leave it at the default.

If it's too llow for that machine you may find that it runs faster for a while but when you start having a bunch of programs open it'll hit a brick wall and put you in swap hell. Trty raising it by 10 if this happens.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
toolrick

Re: Swappiness change

Post by toolrick »

Hoser Rob wrote: Tue Mar 27, 2018 10:32 am As mentioned swappiness doesn't have anything to do with how much RAM you have, it decides when to write to swap depending on how much free RAM is availabe. See here:

https://help.ubuntu.com/community/SwapF ... ange_it.3F

Setting swappiness to 10 isn't correct for eveyone so I'd suggest playing aroung with that value. 10 or less may be too low for a 2 Gb machine. My 1G RAM netbook with MInt Xfce it runs best at 40. Interestingly this was the default Ubuntu.Mint swappiness value for a long time. I've never found the inode cache setting particularly useful so I leave it at the default.

If it's too llow for that machine you may find that it runs faster for a while but when you start having a bunch of programs open it'll hit a brick wall and put you in swap hell. Trty raising it by 10 if this happens.
I will leave it at 30 and see how it goes, also I made an script to clean every once in a while the swap memory as it seems the only way to clean it up is by rebooting the computer which makes it unconfortable.
MScott

Re: Swappiness change

Post by MScott »

toolrick wrote: Tue Mar 27, 2018 9:49 am Do you think with a swap partition of 2GB it's enough for my computer to work well? I have adjusted the swappiness to 30, since I tried to decrease it to 10, but started to work slower everytime I oppened few apps.
Do you think if I make a swap partition of at least 4GB that would make my compuer run faster?
Also how do I make the swap partition? It seems through the instalation it already made the partition at 2GB.

Thanks, RD.
Hi toolrick

I think you're good to go, swap is fine @ 2GB, swappiness @ 30 or 40 is modest... I would add more RAM if it was a system worth upgrading, of course only you can make that determination. I have a Lenovo laptop, modest but works good. I replaced the 1 4GB stick of RAM with 1 8GB - no dual channel capabilities. 4 to 8 GB made a difference on my system, I use Firefox and it can gobble a GB by itself, this worked great for months. So, I got bored, and I knew that other than the manufacturers, 4GB (Samsung), 8GB (Crucial), in every other way they're the same - type of DDR3, latency, voltage. I decided to experiment by adding the 4GB back, in slot 2... I never install mis-matched sets, and I expected problems. Short story is I've had zero problems. 12GB of RAM makes a difference. It was an investment of about $50 U.S. dollars and 10 minutes of my time. Food for thought :idea:
toolrick

Re: Swappiness change

Post by toolrick »

MScott wrote: Tue Mar 27, 2018 12:34 pm
toolrick wrote: Tue Mar 27, 2018 9:49 am Do you think with a swap partition of 2GB it's enough for my computer to work well? I have adjusted the swappiness to 30, since I tried to decrease it to 10, but started to work slower everytime I oppened few apps.
Do you think if I make a swap partition of at least 4GB that would make my compuer run faster?
Also how do I make the swap partition? It seems through the instalation it already made the partition at 2GB.

Thanks, RD.
Hi toolrick

I think you're good to go, swap is fine @ 2GB, swappiness @ 30 or 40 is modest... I would add more RAM if it was a system worth upgrading, of course only you can make that determination. I have a Lenovo laptop, modest but works good. I replaced the 1 4GB stick of RAM with 1 8GB - no dual channel capabilities. 4 to 8 GB made a difference on my system, I use Firefox and it can gobble a GB by itself, this worked great for months. So, I got bored, and I knew that other than the manufacturers, 4GB (Samsung), 8GB (Crucial), in every other way they're the same - type of DDR3, latency, voltage. I decided to experiment by adding the 4GB back, in slot 2... I never install mis-matched sets, and I expected problems. Short story is I've had zero problems. 12GB of RAM makes a difference. It was an investment of about $50 U.S. dollars and 10 minutes of my time. Food for thought :idea:
Thanks for the advice, eventhough my computer it's more like a modern tablet, EMMC hard disk and I cannot get into the hardware since it's all been closed. Fanless and touch screen. I like it a lot because it serves for the purpose even with the limitations it has. I got into linux 1. becase it's an open sourse and I was tired of receiving updates every once in a while, plus I have very limited space in my hard drive (32GB). 2. because I like to try out new things and got tired of windows. I have liked everything from linux so far, but I believe for some reason my computer used to run faster in win10 than now with linux. I am trying it to go smooth with the tasks that I use it for everyday... mostly I work on google docs and internet.

Thanks,

RD
Locked

Return to “Storage”