LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-06-2023, 07:45 AM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Question Why Debian is not using swap as it should, and computer gets really slow when RAM is full or almost full?


Hello, people,

I have Debian installed in 2 computers. One has 15,5GiB of RAM, and a smaller disk, so i made a swap partition of "only" 15,9GiB. The problematic one has a bigger disk, but a fairly small RAM of only 3,8GiB; but i gave it a much bigger swap partition of 59,6GiB.

And the problematic one has an SSD disk, so, for the common uses i do with it, it should not be noticeable. But today, browsers usually grow a lot in memory, as i use them: open and close tabs, of several sites, with videos, images, and all complex things a site can have. This happens in both computers. In the first one, with more RAM, when RAM is full, and swap also is almost full, i close and reopen a few programs. This will make a lot of memory be freed - and the one with the biggest memory usage is always the browser.

But the problematic computer gets reeeeeeeeeeeeally really slow with a lot of swap still being free!

This issue has existed for several months, i just have not taken the time to ask about it here. I tried to search the web for this problem, and possible solutions, but found no good result with my searches.

I imagine some configuration of Debian, or the kernel, or whatever thing i know very little or nothing about.

Can you help me here?
 
Old 04-06-2023, 08:31 AM   #2
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,217

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Have a look at your swappieness setting. See this link for guidance.

-->https://linuxize.com/post/how-to-cha...alue-in-linux/

Use the free command to display free memory and free swap space. Keep in mind you can always add a swap file to swap space.
 
1 members found this post helpful.
Old 04-06-2023, 10:43 AM   #3
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by camorri View Post
Have a look at your swappieness setting. See this link for guidance.

-->https://linuxize.com/post/how-to-cha...alue-in-linux/

Use the free command to display free memory and free swap space. Keep in mind you can always add a swap file to swap space.
Both computers have the same values for everything - except, obvious, the sizes and used numbers. Given what is written in the link you sent, should i try a higher value in /proc/sys/vm/swappiness for in the problem computer? But why its behaviour is so different than the other, since the memory usage is grown with the exact same kind of actions, in the majority of them: browsing several sites?

Last edited by dedec0; 04-06-2023 at 12:18 PM.
 
Old 04-06-2023, 01:15 PM   #4
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,217

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Yes, higher number for swappieness. That makes the system swap more aggresifly. Other things to consider, is the web browser you are using. Some are know to fill up more ram. It can be related to the specific release of a browser as well.

What is the free command telling you on the 2 systems?
 
1 members found this post helpful.
Old 04-06-2023, 02:28 PM   #5
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,886
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
You might want to give zram a try.
https://docs.kernel.org/admin-guide/blockdev/zram.html
https://wiki.archlinux.org/title/Zram
https://pimylifeup.com/raspberry-pi-zram/

Works great on my pi400.
Code:
*free
               total        used        free      shared  buff/cache   available
Mem:            3793        2330         347         319        1619        1463
Swap:           4095         322        3773
Total:          7889        2652        4121
 
Old 04-06-2023, 02:54 PM   #6
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Post

Quote:
Originally Posted by camorri View Post
Yes, higher number for swappieness. That makes the system swap more aggresifly. Other things to consider, is the web browser you are using. Some are know to fill up more ram. It can be related to the specific release of a browser as well.
What i find strange is a behaviour so different, but with the same settings. Making the computer really slow, while there is a lot of swap available, does not make sense to me. I had such slowness in the good computer only when i did not care about the swap being practically full; it ended locking the computer, and i needed to manually reset it (in the hardware, i mean).


Quote:
Originally Posted by camorri View Post
What is the free command telling you on the 2 systems?
Code:
$ free -h # This is the good behaviouring computer
               total        used        free      shared  buff/cache   available
Mem.:           15Gi       9,1Gi       2,1Gi       1,9Gi       4,3Gi       4,5Gi
Swap:           15Gi          0B        15Gi

$ free -h # This is the bad behaviouring computer
               total        used        free      shared  buff/cache   available
Mem.:          3,8Gi       3,0Gi       175Mi       223Mi       583Mi       284Mi
Swap:           59Gi      4,2GiB        55Gi
I just changed the swappiness using 2 things:


# First, I executed the command:
$ sysctl vm.swappiness=80

# To make the above change permanent, I also edited the file:
/etc/sysctl.conf

# adding the line below to it:
vm.swappiness=80

# And i used another command that was in the page sent above,
# and now its output is 80, reflecting the change of the
# command just made:
$ cat /proc/sys/vm/swappiness
80


The browser i prefer is Vivaldi. But i have heard that any current browser will end up using a lot of RAM, if it stays openned for a lot of hours (which is always the case when i restart it to free memory). Vivaldi is based on Chromium, as other browsers i would like to use {except "chorume (meanings 1, 4 or 5)"}, which i will never use.

Is there a browser with minimal memory usage, which can discard everything without needing to close+reopen it?
 
Old 04-06-2023, 04:07 PM   #7
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,217

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
You going to have to experiment with different browsers. Keep an eye on the with free on the system that fails.

It is possible there is another issue we are not aware of. How much free space do you have on your root partition? Insufficient space can cause problems like you describe.
 
Old 04-06-2023, 07:38 PM   #8
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Arrow

Quote:
Originally Posted by camorri View Post
You going to have to experiment with different browsers. Keep an eye on the with free on the system that fails.

It is possible there is another issue we are not aware of. How much free space do you have on your root partition? Insufficient space can cause problems like you describe.
My "eye with free" is on, practically all the time, because i use the system monitor that Mate Desktop has available to put in its UI (the same that Gnome 2 had, since Mate is built to continue that project). I keep it checking: processor, memory, swap, network, system load (right expression, in english?), and disk, in both computers.

The root partitions have a lot of space in both computers: 13GiB¹ in the good computer. And 216GiB¹ in the one with the problem here.

¹→ Is df -h output correct, as International System of Units/Sistema Internacional de Unidades, ou S.I., (in portuguese) says? The free -h command already is.
 
Old 04-07-2023, 01:20 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Let's see these.
Code:
grep -e "."  /proc/sys/vm/over*
grep -e "^Comm" /proc/meminfo
 
Old 04-07-2023, 03:30 AM   #10
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
I'm guessing that it may be something to do with systemd, I use Devuan myself, & I don't get any such problems running Firefox-esr on my machines that only have 4GB ram & no swap space....

(Devuan is a systemd free version of Debian....& I'm not here to bash systemd, just suggesting that it might have something to do with the problem at hand).

Last edited by fatmac; 04-08-2023 at 03:43 AM.
 
Old 04-07-2023, 03:56 AM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
What a ridiculous suggestion - on zero evidence. Maybe it's the network manager, or the text editor in use.

:sheesh:
 
Old 04-07-2023, 06:39 AM   #12
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498

Rep: Reputation: Disabled
Quote:
Originally Posted by syg00 View Post
......on zero evidence. Maybe it's the network manager, or the text editor in use.
You could be right, it might be one of them....although highly unlikely to be a text editor!!!

His system has the problem - mine doesn't!
 
Old 04-07-2023, 10:41 AM   #13
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,886
Blog Entries: 28

Rep: Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533Reputation: 533
Take a look at https://wiki.archlinux.org/title/Imp...torage_devices
https://wiki.archlinux.org/title/swap

I have this in /etc/sysctl.conf :
Code:
# Manual settings - these settings are to optimize for SSD drive
# Ref: https://wiki.archlinux.org/index.php/Solid_State_Drives
vm.swappiness=100 
vm.vfs_cache_pressure=50 
vm.dirty_background_ratio=1
vm.dirty_ratio=50
Brave browser frees up memory in unused tabs.

And /etc/fstab
Code:
proc            /proc           proc    defaults          0       0
PARTUUID=b4b590be-01  /boot           vfat    defaults          0       2
PARTUUID=b4b590be-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
tmpfs	/tmp	tmpfs	defaults,noatime,mode=1777	        0       0
#tmpfs	/var/tmp	tmpfs	defaults,noatime,mode=1777	0	0
#tmpfs	/var/log	tmpfs	defaults,noatime,mode=0755	0	0
#tmpfs	/var/spool	tmpfs	defaults,noatime,mode=1777	0	0
 
1 members found this post helpful.
Old 04-07-2023, 07:38 PM   #14
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Post

Quote:
Originally Posted by syg00 View Post
Let's see these.
Code:
grep -e "."  /proc/sys/vm/over*
grep -e "^Comm" /proc/meminfo
I did these 2 in both computers:


# Good computer

$ grep -e "." /proc/sys/vm/over*
/proc/sys/vm/overcommit_kbytes:0
/proc/sys/vm/overcommit_memory:0
/proc/sys/vm/overcommit_ratio:50

$ grep -e "^Comm" /proc/meminfo
meminfo

$ grep -e "^Comm" /proc/meminfo
meminfo

$ grep -e "^Comm" /proc/meminfo
CommitLimit: 24831676 kB
Committed_AS: 27777048 kB

$

# Bad computer, which is in a fairly slow situation, right
# now. I am not using it much, today, so, we can test it
# in some things that need this happening (if they exist).

$ grep -e "." /proc/sys/vm/over*
/proc/sys/vm/overcommit_kbytes:0
/proc/sys/vm/overcommit_memory:0
/proc/sys/vm/overcommit_ratio:50

$ grep -e "^Comm" /proc/meminfo
CommitLimit: 64473816 kB
Committed_AS: 11112736 kB

$


Meaningful?
 
Old 04-07-2023, 07:43 PM   #15
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Question

Quote:
Originally Posted by fatmac View Post
I'm guessing that it may be something to do with systemd, I use Devuan myself, & I don't get any such problems running Firefox-esr on my machines that only have 4B ram & no swap space....

(Devuan is a systemd free version of Debian....& I'm not here to bash systemd, just suggesting that it might have something to do with the problem at hand).
Did you mean "that only have 4M ram"? 4B is four bytes, and this make no sense.
 
  


Reply

Tags
debian, memory, ram, swap



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why is my Debian computer only using 2GB RAM? (i686 2013 Macbook Pro running Debian KDE) theOakBaron Linux - Hardware 4 02-03-2018 04:18 PM
Why swap space did not function when physical memory ( RAM ) is full ? subankar Linux - Server 7 10-11-2012 12:02 PM
Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM??? Saurav Ghosh Linux - Newbie 7 11-01-2011 03:49 AM
Why should you give the size of the swap disk as twice the size of RAM vmniza Linux - Newbie 3 09-17-2004 02:13 AM
why swap should be twice of RAM? whitefox Slackware 17 04-19-2003 02:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration