LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Why Debian is not using swap as it should, and computer gets really slow when RAM is full or almost full? (https://www.linuxquestions.org/questions/debian-26/why-debian-is-not-using-swap-as-it-should-and-computer-gets-really-slow-when-ram-is-full-or-almost-full-4175723824/)

business_kid 04-12-2023 06:56 AM

First a correction
Code:

I'm seeing 30 posts here, which is crazy
  • Do the filesystems check out with e2fsck and smartctl's comprehensive tests?
  • Post the output of sensors with the pc running slow.
  • Post the bootup errors. I don't read full logs, except my own.

pan64 04-12-2023 07:05 AM

Quote:

Originally Posted by dedec0 (Post 6423867)
Right. Thank you for this list.

I will try this starting list, for now. I have already checked how to disable swap, I will just prepare a few details to avoid losing anything, in the case of the system killing running programs.

A problem of very slow network should not be the problem, I think. The network for these 2 computers is the same: both connected with a cable to the same modem (and it receives data with a coaxial cable, from the network company). I would see the slowness in the other computer, I think.

before you disable your swap:
https://chrisdown.name/2018/01/02/in...e-of-swap.html

dedec0 04-26-2023 11:49 PM

What happened here?
 
Hello, people. A good number of days has passed, and i did not look into this problem anymore. There are a few things, important to mention here, that happened in all these days:

1. The computer with the slowness problem was never turned off, or rebooted. Since the last few messages i posted here, it was already fairly slow. I closed the browser 2 times. In the first time, i took several minutes to change to a text only session - ctrl+alt+f6 - which i usually use to:

Check the id of 2 "important" processes, using pstree and view (which is Vim editor, anyway), or an alias i have to quickly search the output of ps -Af. The process I usually search is vivaldi - that i have mentioned here before, because it uses a lot of memory, as time passes and i use more pages and new tabs, both in normal and private windows, not usually always growing the number of open tabs. Just closing the tabs or windows, does not free as much memory as killing vivaldi (never with signal 9, it will not need much time to close, although it does not close immediately in these slowness periods). Telegram process is the only other process, of things i use in this computer, that could be imagined using a lot of memory, as time passes, with it being used to do everything it can.

2. I had much patience to wait the slowness moments. The RAM was basically full all the time, including the moments after my "cleaning memory" habits, cited in step 1. The swap usage slowly increased to an amount i never saw before, in this computer! More than half of swap seemed to be in use! This is just a visual guess, and i compare the graphic of swap that got used, with the biggest swap use i ever saw, before and during this thread - until now. The slowness was kind of extreme. Moving the mouse to click a window button, its window manager focus button, or do anything, took several seconds, sometimes a few minutes. Keyboard actions were also slow to happen in all programs, most of the time. This is true even for the basic and simple actions programs, like vim or view in a terminal, the common terminal commands, etc. I could still keep my habit of using this computer to hear online radios or videos, live programs, some live, some recorded. It was slow to start or change them, but it worked. The computer was not locked, and maybe the frozen state i imagined for it before, it was like all this, in fact. To do these things i cited here, i use the browser or vlc. But i did not watch several programs that need more action to be found, played, and so on. The ones with less actions to start were the only chosen. The other computer does not have something to audio output, now, thus, some wanted to watch things got lost.

3. Since yesterday, I was preparing the compo with the slowness problem to make the commands that i found to "clear RAM memory cache and buffer, and to clear swap too" (this is a link of a nice tutorial with good explanations). Since it seems something that may not always be safe, given the warning made here, and another one in this site itself, i was making sure everything would be safe and backed up. But before i finished this process, i slept before the usual time. Not even an hour ago (now is 1:10 here, 24h clock), i woke up again. At the point i slept, the computer had all, or nearly all, the RAM in use; a lot of swap in use too, something i never saw before; vivaldi and telegram were not running, but this did not release much RAM, as it usually happens, in both computers.

4. Now, after i woke up, in a sleep of not many hours, the RAM usage is, checking the Mate graphs i always have on: 24% in use by programs; 16% usage as cache. Swap usage is 4%. I cannot explain! I almost never use other programs in this computer, that can be imagined to use a lot of memory and/or processor and/or disk. The most used ones are the browser; vlc media player to watch videos or listen to live streams; Telegram. Besides these, what is always opened is just Pluma, the simple text editor that Mate has, and a Mate Terminal with a few tabs. Vim and its children, Gimp, xpdf, the other PDF viewer, and LibreOffice are programs i use rarely with it. Most of the time, these are not open, or opened without anything being used or created with them. Most of the time, i will open and work with these kinds of files in the other computer.

So, what happened? Was all the memory not freed until hours passed, without it being used at all, and having no process associated with it?

The commands we find in the site pointed in step 3 would make this action happen before such time elapses? If it is not, is there a way to do it?

pan64 04-27-2023 01:26 AM

see this: www.linuxatemyram.com

_blackhole_ 04-27-2023 08:26 AM

Quote:

Originally Posted by dedec0 (Post 6422748)
But the problematic computer gets reeeeeeeeeeeeally really slow with a lot of swap still being free!

Once all memory is in use and it starts swapping, you will see a dramatic decline in performance - the problem is that you are getting to that stage in the first place. From what you have described, you have too much running on a system with too little RAM.

business_kid 04-28-2023 04:48 AM

Are you guys running linux with a stable kernel? I'm beginning to doubt it.
Memory is used for memory until it runs out, which is rare unless you're being stupid. As the memory fills up, a buffer is kept and as ram is low, swap is used. You slow your ram access to the speed of spinning rust, but otherwise life goes on.

What's inclined to slow a system are memory faults (check with memtest86), disk faults (check with smartctl), opening piles of bloatware, or cramming huge ramdisks. Running windows VMs might do it too, or gaming. Basically, if you're not a server, normal operation uses less than 4 Gig.

Rebooting is generally a good thing, as it closes all the crap you had open. Linux uses clever techniques like 'copy on write' to minimize memory use.

When people provide all details, do what what is suggested, and use their brains, most problems are solved inside 8-12 posts. I'm unsubscribing because at 35 posts, it's clear you aren't doing any of that. You apparently want to talk rather than solve anything.

In the unlikely event that you are seeking a solution and I have woken you up, re read the thread.

dedec0 04-28-2023 03:41 PM

Quote:

Originally Posted by _blackhole_ (Post 6427276)
Once all memory is in use and it starts swapping, you will see a dramatic decline in performance - the problem is that you are getting to that stage in the first place. From what you have described, you have too much running on a system with too little RAM.

In my previous post, I have said everything that is used - and besides what I mentioned, it is rare that I use other things, and they will not be memory or disk intensive things: no games, no VMs of any kind, no "strange" software.

And what business_kid says in post #36 is useless. It mentions an usual fact, but "usual fact" is far from being "all cases such fact is possible and easy".

dedec0 04-28-2023 03:56 PM

Quote:

Originally Posted by pan64 (Post 6427214)

Thank you very much for this page. It explained several useful things.

From that page, one fact shown by free -mh command, now, makes me think:

Code:

              total        used        free      shared  buff/cache  available
Mem.:          3,8Gi      2,6Gi      919Mi      250Mi      628Mi      645Mi
Swap:          59Gi      3,9Gi        55Gi

I have not yet done several things that are mentioned above, to test the computer in important aspects. I will do them when i can. I wrote the post about the "magically freed" memory because it could be an explanation to everything happening here - so, i imagined.


All times are GMT -5. The time now is 07:06 AM.