Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing #4

Open
hakavlad opened this issue Dec 21, 2020 · 8 comments
Open

Testing #4

hakavlad opened this issue Dec 21, 2020 · 8 comments

Comments

@hakavlad
Copy link
Owner

Put here your results and experience.

@tim77
Copy link
Contributor

tim77 commented Jan 2, 2021

webkit2gtk3 compilation https://youtu.be/U6PbtA1gZvI

@ValdikSS
Copy link

ValdikSS commented Jul 10, 2021

I have an old Core2 Duo E4600/2GB RAM/SATA II HDD PC running Linux Mint XFCE 20.2 64 bit.

Case 1

  • Default Mint kernel (5.4)
  • Swap on HDD

Upon opening many tabs in Firefox, when the RAM consumption reached its max, swapping process was slow and mild thrashing occurred, making system very slow and unresponsive at times, but it did not hang for very long. Switching between running applications took tens of seconds, during which either a blank/black window with no content was present or it took time to just show the application window.
Starting new application (xfce calculator, very lightweight) took about 15 seconds.
3 times the mouse pointer froze for 3-6 seconds.

Case 2

  • Default Mint kernel (5.4)
  • Swap in zram only

Upon opening many tabs in Firefox, when the RAM consumption reached its max, swapping process was fast (it's zram), but due to file cache eviction and slow HDD, switching between applications took a long time and starting new applications also took up to 3 times more than with free RAM.
The system was responsive all the time, but uncomfortably slow.

Case 3

  • Self-compiled 5.10.46 kernel
  • Swap in zram only

Basically the same as in Case 2.

Case 4

  • Self-compiled 5.10.46 kernel with le9db1, vm.clean_low_kbytes=524288, vm.clean_min_kbytes=0
  • Swap in zram only

Upon opening many tabs in Firefox, the RAM consumption reached about 1.4 GB, then the system started swapping to zram. Switching between applications was as fast as with free RAM. Starting new applications took not much longer than with free RAM (maybe several seconds longer, still much faster than in case 1/2).

Even under VERY heavy RAM load the system was very responsive, although running new applications took much longer (≈2 times), but not as long as in Case 1/2.

The video shows the following applications running simultaneously:

  • Firefox with 37 active tabs (all data in RAM, no tab unloading, everything is fair)
  • Discord
  • Skype
  • LibreOffice with the document opened
  • Two PDF files (14 and 47 megabytes in size)

Almost 3 GB in zram swap, so almost 5 GB of real RAM usage with 2 GB of physical RAM. For me, that's an impressive result.

oldpc2007-le9-lowq.mp4

Here's my small note, with ready-to-use LiveCD with le9: https://notes.valdikss.org.ru/linux-for-old-pc-from-2007/en/

@ValdikSS
Copy link

There are people who suggest to tune vm.swappiness option. Indeed, you can set it to 200 to give full priority to swapping anonymous pages instead of dropping file cache, but it's not that precise and does not keep enough amount of file cache in near-full RAM cases. It makes things better a bit overall, and is definitely a good choice for SSD, but on HDD it doesn't help that much.

@polarathene
Copy link

polarathene commented Jul 15, 2021

Indeed, you can set it to 200 to give full priority to swapping anonymous pages instead of dropping file cache, but it's not that precise and does not keep enough amount of file cache in near-full RAM cases.

You don't have to set it all the way to 200, IIRC the docs advise around 133? Depends on context of workloads, but I think there is some merit to not being overly aggressive even if you have zram for swap only.

switching between applications took a long time and starting new applications also took up to 3 times more than with free RAM.
Almost 3 GB in zram swap, so almost 5 GB of real RAM usage with 2 GB of physical RAM.

Just wanted to add that if you're too aggressive with zram, in the context of it being filled up it negatively impact responsiveness.

Even when not performing desktop tasks, eg running some long running computation that's heavy on resource usage I have noticed performance suffer when the ratio of RAM allocated to zram is too much, heavy overhead from swap thrashing.

Thus it can be helpful to give the system a bit more breathing room under memory pressure. My tests were on 1GB VPS machines however where 3GB of ZRAM would not necessarily be reached but use up to around 700MB compressed (averaging 2GB uncompressed), but regardless of compressor used, if the amount of RAM ZRAM allocated was lowered and the workload not likely to OOM, it was often notably faster.

I believe due to that scenario I observed disk swap paired with zswap as being more performant. The latency of disk access when required was less of a hit than compressed swap in RAM taking too much. I believe zswap started to suffer after 20-30 percent memory pool size with that workload, otherwise was faster than zram.


I don't know much about le9 yet, but assume it's better handling that situation and will have to measure it some time.

The workload scenario I had could complete in about 10 seconds with 2GB of RAM, but on 1GB system was 2 minutes IIRC, memory load was around 2GB total uncompressed. If I find time to measure again, I will do it again and see how le9 affects it :)

@hakavlad
Copy link
Owner Author

the docs advise around 133?

133 in docs is just an example:

For example, if the random IO against the swap device is on average 2x faster than IO from the filesystem, swappiness should be 133 (x + 2x = 200, 2x = 133.33).

https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/sysctl/vm.rst#swappiness

I think that zram is much more than 2 times faster than HDD in most cases.

if you're too aggressive with zram, in the context of it being filled up it negatively impact responsiveness

zram disksize = 4 * MemTotal. No responsiveness issues: https://www.youtube.com/watch?v=1uhcZwuvXLI (with le9).

@reneleonhardt
Copy link

zram disksize = 4 * MemTotal. No responsiveness issues: https://www.youtube.com/watch?v=1uhcZwuvXLI (with le9).

Amazing job, just saw it on Phoronix, hope you get lots of testing and reviewing so it can be mainlined soon, millions of computers finally perfectly usable again! 👍

@gottaeat
Copy link

if those who ran tests of their own could give this question a read, i'd be very grateful, thank you.

@backslashxx
Copy link

backslashxx commented Oct 24, 2023

Running this on Mi A2 Lite currently. Android 13 / Linux 4.9. Works really nice.
Device has 4GB (around 3.5GB usable), ZRAM enabled, 1:1.
System keeps up with heavy memory pressure.

image

video6179467927507438481.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants