Why Debian is not using swap as it should, and computer gets really slow when RAM is full or almost full?
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
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?
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
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?
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.
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.
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,498
Rep:
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).
# 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
# 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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.