User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

default 100 meg swap file

Mon Aug 19, 2019 9:25 pm

Why did they decide to do this?
its severely debilitating.
People coming from windows will not understand having to adjust the size of their swap file.
maccaps.com - bringing life to dead electronics.

epoch1970
Posts: 3564
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: default 100 meg swap file

Mon Aug 19, 2019 9:33 pm

I’ve never touched the swap file on any of my Raspbian installs. I’ve had some machines working for years on the same install, with excellent availability.

What are you running that needs changing the swap file settings?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

MisterEd
Posts: 90
Joined: Mon Apr 16, 2018 5:28 am
Location: Huntsville, AL USA

Re: default 100 meg swap file

Mon Aug 19, 2019 11:24 pm

pi-tastic wrote:
Mon Aug 19, 2019 9:25 pm
Why did they decide to do this?
its severely debilitating.
People coming from windows will not understand having to adjust the size of their swap file.
Why do you want to use a swap file? Using it will cause excessive writes to the SD Card. Since reads & writes to the SD Card is much slower than RAM then your computer performance will suffer.

User avatar
davidcoton
Posts: 4033
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: default 100 meg swap file

Mon Aug 19, 2019 11:46 pm

There's a long and somewhat acrimonious discussion here, which explains how to set swap to work only when really needed -- so that an over-committed system will not crash, but swapping will not occur until RAM is exhausted and some action is essential for system stability.

Yes, in general, swapping to SDCard is bad, but it's better than letting the system kill processes to free RAM.
Signature retired

User avatar
scruss
Posts: 2420
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: default 100 meg swap file

Mon Aug 19, 2019 11:51 pm

I think there's a whole lot more different about Windows than worrying about the swap facilities.

Also seconding the "haven't ever needed to mess with swap" suggestion. You'll almost never use it, but when you need it, it's better than the system crashing. Looking at that other thread, the OP has no idea what they're on about. They just heard "SWAP BAD!" and started yelling.

Now, swapping to TK50s was no fun at all
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
Gavinmc42
Posts: 3631
Joined: Wed Aug 28, 2013 3:31 am

Re: default 100 meg swap file

Tue Aug 20, 2019 1:33 am

I increase my swap to 1000MB but only because I do some serious compiling.
Now that I have a 2GB PI4 and later a 4GB PI4, that might not be needed.
I did noticed Chromium did not give me as many problems as it did other Pi4B1 users.
Some have said 400MB swap might be ok for Chromium's needs.

100MB is probably a good size for most users.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:17 pm

Just upped my swap from 100m to 2000m on the 3B+ and its So So much better now!!!

Maybe adding a swap file slider in the Raspi Config GUI app?
maccaps.com - bringing life to dead electronics.

trejan
Posts: 524
Joined: Tue Jul 02, 2019 2:28 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:19 pm

pi-tastic wrote:
Tue Aug 20, 2019 3:17 pm
Just upped my swap from 100m to 2000m on the 3B+ and its So So much better now!!!
You've still not actually said what you're doing. How are you judging it to be "So So much better now"? How much swap is utilised?

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:32 pm

chrome + casual apps / general use.
maccaps.com - bringing life to dead electronics.

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:33 pm

Screenshot from 2019-08-20 11-08-05.png
Screenshot from 2019-08-20 11-08-05.png (88.54 KiB) Viewed 742 times
maccaps.com - bringing life to dead electronics.

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:47 pm

test1.jpg
test1.jpg (164.53 KiB) Viewed 731 times
maccaps.com - bringing life to dead electronics.

trejan
Posts: 524
Joined: Tue Jul 02, 2019 2:28 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 3:48 pm

The proper solution is the obvious buy a Pi 4 with more RAM but if the performance is acceptable to you then go for it. You should test to see if using zram helps as I expect a lot of it to compress fairly well which may reduce the amount actually written to the SD card. Otherwise reduce the number of open tabs and periodically restart Chromium as it can leak memory.

Increasing the default swap file size will cause problems for people using small SD cards. It isn't good for your card either for wear on the flash and when people just abruptly turn it off.

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 4:01 pm

sudo modprobe zram

and that is all? seems pretty harmless :)
maccaps.com - bringing life to dead electronics.

trejan
Posts: 524
Joined: Tue Jul 02, 2019 2:28 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 4:02 pm

pi-tastic wrote:
Tue Aug 20, 2019 4:01 pm
sudo modprobe zram

and that is all? seems pretty harmless :)
No. That just loads the module. It creates compressed ram disks so you still need to actually tell it to use them for swap.

User avatar
scruss
Posts: 2420
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: default 100 meg swap file

Tue Aug 20, 2019 6:36 pm

pi-tastic wrote:
Tue Aug 20, 2019 3:32 pm
chrome + casual apps / general use.
15+ tabs, including a Youtube one, all on a huge desktop is hardly casual use for a computer with roughly the capabilities of an old mobile phone.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
pi-tastic
Posts: 109
Joined: Mon Jul 29, 2019 6:34 pm

Re: default 100 meg swap file

Tue Aug 20, 2019 7:12 pm

And it works great after the 2000m swap file mod.
Worth every penny of that 25 dollars.
maccaps.com - bringing life to dead electronics.

LTolledo
Posts: 1788
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: default 100 meg swap file

Tue Aug 20, 2019 8:54 pm

this was on a 2000mb swap on this USB SSD native boot RPi3B+. its still on 2000mb swap.
myRPi3B+Desktop.jpg
myRPi3B+Desktop.jpg (104.01 KiB) Viewed 587 times
I can set it higher but on the instance above I checked htop and it used only less than 500mb asI remember
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
jcyr
Posts: 241
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: default 100 meg swap file

Tue Aug 20, 2019 9:07 pm

Not even sure what the default swap size is. Just recompiled GCC as cross compiler for the RISC-V architecture on a 4 Gig Pi4 (make -j4). It took forever but no issue with ram.
It's um...uh...well it's kinda like...and it's got a bit of...

LTolledo
Posts: 1788
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: default 100 meg swap file

Tue Aug 20, 2019 9:46 pm

Update on my image above
this time with 15tabs chromium on RPi3B+,
and accessing RPi3B via VNC,
both playing VLC, media accessed from NAS
the rest you can see on the image.
RPi3B+Desktop_vnc_RPi3B.jpg
RPi3B+Desktop_vnc_RPi3B.jpg (233.25 KiB) Viewed 558 times
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
Gavinmc42
Posts: 3631
Joined: Wed Aug 28, 2013 3:31 am

Re: default 100 meg swap file

Wed Aug 21, 2019 1:24 am

Not even sure what the default swap size is. Just recompiled GCC as cross compiler for the RISC-V architecture on a 4 Gig Pi4 (make -j4). It took forever but no issue with ram.
jcyr, How long did this take?
I did it with a 3B+ and Gentoo64 with 1000MB swap, it took 13hours.
This sort of thing is why I am hanging out for some 4GB Pi4's to make it down under.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
jcyr
Posts: 241
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: default 100 meg swap file

Wed Aug 21, 2019 1:50 am

Gavinmc42 wrote:
Wed Aug 21, 2019 1:24 am
Not even sure what the default swap size is. Just recompiled GCC as cross compiler for the RISC-V architecture on a 4 Gig Pi4 (make -j4). It took forever but no issue with ram.
jcyr, How long did this take?
I did it with a 3B+ and Gentoo64 with 1000MB swap, it took 13hours.
This sort of thing is why I am hanging out for some 4GB Pi4's to make it down under.
About 6 hours.
It's um...uh...well it's kinda like...and it's got a bit of...

fanoush
Posts: 464
Joined: Mon Feb 27, 2012 2:37 pm

Re: default 100 meg swap file

Wed Aug 21, 2019 8:47 am

davidcoton wrote:
Mon Aug 19, 2019 11:46 pm
Yes, in general, swapping to SDCard is bad, but it's better than letting the system kill processes to free RAM.
This would be true if the default value was not 100MB.

Without swap you get killed processes but the system works. With 100MB swap this gets filled almost instantly and you get swapping hell with SD card light constantly on and no way to safely turn it off. I killed one SD card by giving up after waiting tenths of minutes in this state and pulling the plug finally. After reboot the card was permanently in read only mode i.e. dead.

IMO the 100MB value is very dangerous and makes no sense. Make in at least 500MB or 1GB so the system can get slow without going to swapping hell immediately without warning after you e.g. open one more tab in chromium. Or turn it off.

epoch1970
Posts: 3564
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: default 100 meg swap file

Wed Aug 21, 2019 9:06 am

So basically: 100MB is fine for most Lite users, and 512/768MB would be better for most Desktop users, because Chromium.
Is this correct?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
HawaiianPi
Posts: 4534
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: default 100 meg swap file

Wed Aug 21, 2019 10:58 am

Have you changed your system "swappiness" settings? The default of 60 is rather bad for low RAM systems (start swapping when less than 60% of your RAM is free). It's basically the percentage of free memory remaining before swap is used. So the default is to swap with more than half your RAM still available. I set mine to 10 (only swap after 90% of RAM is in use).

Check your current setting (default is 60, or swap after 40% of RAM is in use).
cat /proc/sys/vm/swappiness

Temporary change for testing (returns to default after reboot).

Code: Select all

sudo sysctl vm.swappiness=10

To change it permanently.

Code: Select all

sudo nano /etc/sysctl.conf
Scroll down to the bottom and add, vm.swappiness=10 (or whatever value you want). Save the file and that will be your new default.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “General discussion”