PINE64
Arch and ZRam - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PineTab (https://forum.pine64.org/forumdisplay.php?fid=140)
+--- Forum: PineTab Software (https://forum.pine64.org/forumdisplay.php?fid=142)
+--- Thread: Arch and ZRam (/showthread.php?tid=11459)



Arch and ZRam - wd5gnr - 09-15-2020

From: https://wiki.archlinux.org/index.php/Improving_performance#Zram_or_zswap


Quote:
The systemd-swap package provides a systemd-swap.service unit to automatically initialize zram devices. Configuration is possible in /etc/systemd/swap.conf.
The package zramswapAUR provides an automated script for setting up a swap with a higher priority and a default size of 20% of the RAM size of your system. To do this automatically on every boot, enable zramswap.service.

I installed zramswap and found that /etc/zramswap.conf actually sets 40% (the default is 20 if you don't set it there). However, it does seem like that has been a good performance boost, especially when running Vivaldi.


RE: Arch and ZRam - peperjohnny - 09-16-2020

Thanks for the tip. Plasma desktop got a bit faster with that.


RE: Arch and ZRam - wd5gnr - 09-16-2020

(09-16-2020, 06:17 AM)peperjohnny Wrote: Thanks for the tip. Plasma desktop got a bit faster with that.

My current configuration seems to be OK, but not sure if it is really better or not. I have a pretty large SDcard mounted in /etc/fstab as /sdcard

The following as root:
dd if=/dev/zero of=/swapfile bs=1MiB count=1024
mkswap /swapfile
# note you will need /sdcard mounted first:
dd if=/dev/zero of=/sdcard/swapfile bs=1MiB count=4096
mkswap /sdcard/swapfile

#oops forgot these:
chmod 600 /swapfile /sdcard/swapfile

Then in /etc/fstab:
/dev/mmcblk0p1 /sdcard ext4 rw,relatime,nofail
/swapfile swap swap pri=50 0 0
/sdcard/swapfile swap swap pri=0 0 0

Combined with the ZRAM swap at priority 100, this gives you a 1G swap on the eMMC and 4G of (presumably) slower swap on the SDCard.

If you don't want to reboot, do (as root):

swapon -a
 

Verify with:

swapon -s


I have left vm.swappiness at 60 but it might do to turn it higher to make more RAM available for caching. 

sysctl -w vm.swappiness=90

Make that permanent in /etc/sysctl.conf or sysctl.d

But like I say, I've left it at 60 to see how it does for a bit.

By the way, you can't use fallocate. It leaves a sparse file which will not mount.


RE: Arch and ZRam - wd5gnr - 10-27-2020

If you use this setup, I noticed that /usr/lib/systemd/system/tmp.mount puts /tmp as tmpfs which uses RAM and eventually you get crashes. For some reason, systemctl disable doesn't stop this, so I renamed tmp.mount to tmp.nomount and rebooted. Seems to help performance quite a bit.


RE: Arch and ZRam - tomoqv - 12-03-2020

(09-15-2020, 06:41 AM)wd5gnr Wrote: From: https://wiki.archlinux.org/index.php/Improving_performance#Zram_or_zswap


Quote:
The systemd-swap package provides a systemd-swap.service unit to automatically initialize zram devices. Configuration is possible in /etc/systemd/swap.conf.
The package zramswapAUR provides an automated script for setting up a swap with a higher priority and a default size of 20% of the RAM size of your system. To do this automatically on every boot, enable zramswap.service.

I installed zramswap and found that /etc/zramswap.conf actually sets 40% (the default is 20 if you don't set it there). However, it does seem like that has been a good performance boost, especially when running Vivaldi.

I am using zramswap with
Code:
ZRAM_SIZE_PERCENT=100
and I believe I notice a significant performance boost. How do I make this survive a reboot? Now I have to do
Code:
systemctl start zramswap
after rebooting?