zram swap: Speed analysis on an old laptop with low memory

Full article: Faster Linux on low memory using zram (ubuntu 22.04)

I have an old Acer Aspire V3-772 laptop. I am still quite happy with that old 17-inch brick, but its age is showing, especially the somewhat low memory. I can still develop software nowadays, but a lot of development packages got very memory hungry over time and cause severe and thus annoying slowdowns every now and then. 8 GB were plenty 10 years ago, but now I find myself pushing the limits of the machine a bit.

This made me wonder if in-memory compression could help somewhat with this problem. After all, the machine still mostly works for me. Adding more memory would be the easy solution, but maybe in-memory compression could be a cheaper solution to my problem – or at leas a temporary fix. Windows and Android do it as well, so maybe it can help my laptop as well!

The kernel’s zram-block device can be configured easily as a swap-backend in ubuntu 22.04, which comes with a handy package called zram-tools. I tested if configuring zram would yield any measurable improvements on my laptop using different zram amounts (0%, 5%, and 20% of system memory) and in two different test conditions, “normal memory” and “low memory” with, respectively, average and high memory-use workloads. For these two conditions I measured how long it took to open my webbrowser and play a youtube video.

(Median) number of seconds it took until playback of the Youtube video started for each of the test conditions.

As can be seen, configuring zramswap improved the responsiveness of my laptop for the specific tests.

However, subjectively, the tests did not quite seem to cover all aspects that go into using a computer in an interactive way. Starting some programs outside the test-set seemed more sluggish when using a 20% zram configuration compared to the 5% zram configuration. Therefore, I left the setting at 5% for daily use. See the full article for more details on the tests and conclusions.

All in all, experimenting with zram to increase the lifetime of my laptop’s hardware was very interesting. I have the feeling that zramswap might benefit a lot of systems out there, but the module still remains a rather obscure kernel feature, I have the feeling (outside Android).

I personally in the long run might nonetheless invest in more memory. That will more reliably improve performance even more. Or maybe it is time to swap out the 9 year old laptop entirely by now.

Leave a Reply

Your email address will not be published.