Computer block by high ram usage (SWAP saturated)

I wasn't aware of that, interesting, I'll do some measures, soon.
I thought the android 'go' apps should address exact this issue on devices with less memory/computing power.
Source: Android (Go edition)

1 Like

I assume that this is possible with the android-x86 OS (is this the correct name? not sure...), which is an android system based on PC architecture, so yes you can run it from a virtualbox, then put the VBOX in hybrid mode and you can run these apps showing directly on your desktop :slight_smile: - the only issue here is that booting an OS also takes a lot of RAM, which can be easily bigger than a browser's tab. Solution?: probably run it from a chroot, like explained here Run applications from any other operating system (in your Elive) , so it doesn't consumes any RAM nor any resouces except the ones of the app itself, I have successfully run songbird from a small debian wheezy chroot :dance:

it's exactly what i was thinking about.

True but often times the bottleneck is the cpu itself when opening boatled pages like youtube and facebook, rather than the ram (i mean anyway when you are browsing facebook or youtube you're not having so many more tabs open!).

It may be an interesting project make a gui manage fot his. really

It actually would be but I can see some caveats using a GUI, like "root" not having access to X11 i.e wrong permissions.

1 Like

maybe we can write a small / amazing howto, "how to run android apps in elive", so:

  • download android-x86
  • uncompress in a chroot
  • run apps from the chroot
  • bingo :partying_face:

I was just thinking on that :smiley:

that should be not hard to resolve :thinking:

noted the idea in my infinite list of tasks to-do

2 Likes

I think i can. Where would you upload the tutorial? Here on the forum?

Yes, as a howto or as a wiki entry where the latter can be edited by others

1 Like

I remember a while back we were talking about how Linux swaps terribly (I think it was @Thanatermesis who called the code garbage).

I found this old message on the BGLUG mailing list and thought might be interesting. NOTE: Observations here were, according to the emailer, were conducted on kernel 4.6 (it's a message from July/August 2019). It may not work on later versions, and I can't really test right now (very very busy) so let me know how it works out for you.

One of the problems I've observed with recent linux kernels is the
difficulty the system has allocating large amounts of memory when it
memory usage is high. The system starts reading swap like crazy, (on
SSD, swap is reading at over 400MB/s), and the system becomes unusable.
In a test on a 8GB system, with firefox running several open tabs, and
then start a 4GB Virtual Machine, swap usage grows to 155MB, but then
the system gets stuck reading from the swap drive at 400MB/s for over 2
hours... (I don't know how long this would have continued, I forced quit
firefox to free ram and liberate the system. Swap never grew past 155MB
during this time.)
This problem only shows up if you're using more memory than you have
RAM, and many people now probably just buy more memory if they encounter
this kind of situation. I, however, do not feel that a system becoming
unusable for going over a few hundred MB makes sense on modern demand
paging system.
At first, I experimented with the /proc/sys/vm/swappiness variable.
Setting this to 100 helped prevent the situation from happening in my
regular workload, (before I introduced a virtualized Windows 10). This
would force the kernel to keep cache size at about 1.5GB, which left
enough available ram to load new allocations used by all my programs.
However, it turns out that the variable I needed to fix was
/proc/sys/vm/watermark_scale_factor
Default value here is 10, it goes up to 1000. After some
experimentation, I figured out that 500 is the value I need to stop my
system form this bad behaviour. Now if I try to allocate a large chunk
of memory, the kernel is able to swap out enough on the fly for the
system to stay functional and stable. (I was actually able to test with
dozens of open firefox youtube instances and a 4GB Virtual Machine.
Total memory usage climbed to well over 11 GB (out of an 8GB system.)
The swapping was crazy, and probably would be death to an SSD to keep
that going forever, but unlike before, the system did not become
unusable while stuck in a perpetual swap reading loop.)

Thanks for the post @TheTechRobo :slight_smile: I'm going to experiment and research about this /proc/sys/vm/watermark_scale_factor option, if it works better, I will set it by default like this in Elive for everybody

Unfortunately my actual computer doesnt' feels much this issue (maybe because my SWAP warning scripts warns me everytime the memory usage grows and I inmediately close the browsers before to get stuck in the hell :rofl2: ), so I invite others that has the same issue of computer blocked to try if that option works better

how to enable it permanently:

sudo su
echo -e "# betatesting https://forum.elivelinux.org/t/computer-block-by-high-ram-usage-swap-saturated/1863/28 :\n# Set the aggressiveness of kswapd to 5%:\nvm.watermark_scale_factor = 500" >> /etc/sysctl.d/swappiness.conf
sysctl --system

IMPORTANT: It is also needed to betatest it with mechanical hard disks, in order to know that is an improvement, the resulting behaviour between an SSD and mechanical disk are giant and entirely different

Interesting read: Tuning the Memory Management Subsystem | System Analysis and Tuning Guide | openSUSE Leap 42.3

note: that original post of @TheTechRobo from a new thread was moved to this one, to still on topic and correct category

1 Like

Once we are in E2*, we can just do the "fake segfault" as described in the thread "how to force shut-down your computer avoiding data loss in Linux" and all their stuff will still be open, I think they might be annoyed if their browser is killed as they might be entering unsaved data :thinking: :thinking: maybe we should not install by default chromium, so that its harder for them to install chromium and slow down their PC than just using the better browser :rofl2: :rofl2:

Yep, everything anyone does is "how can I get money out of this???" they'd do anything for money :expressionless:

It never slows down for me (even at three gigs swap!) but that could be that I use a samsung 860 evo ssd...I didn't test BEFORE the change but judging from your other ssd experiences it has improved :thinking:

Try AltSysrqF if that ever happens again. That calls oom_killer, so it will (?) kill processes using high amounts of RAM (like the browser).

There's also GitHub - rfjakob/earlyoom: earlyoom - Early OOM Daemon for Linux.