le9-patch icon indicating copy to clipboard operation
le9-patch copied to clipboard

Testing

Open hakavlad opened this issue 3 years ago • 8 comments

Put here your results and experience.

hakavlad avatar Dec 21 '20 15:12 hakavlad

webkit2gtk3 compilation https://youtu.be/U6PbtA1gZvI

tim77 avatar Jan 02 '21 18:01 tim77

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.

https://user-images.githubusercontent.com/3054729/125176628-a6f49180-e1dd-11eb-834e-6e94776c27bf.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 avatar Jul 10 '21 21:07 ValdikSS

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.

ValdikSS avatar Jul 14 '21 17:07 ValdikSS

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 :)

polarathene avatar Jul 15 '21 00:07 polarathene

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).

hakavlad avatar Jul 15 '21 14:07 hakavlad

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! 👍

reneleonhardt avatar Jul 16 '21 10:07 reneleonhardt

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

gottaeat avatar Jul 29 '21 18:07 gottaeat

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

backslashxx avatar Oct 24 '23 23:10 backslashxx