Zram
This page documents how to set up ZRAM in Alpine.
Installation
Install the neccessary packages.
# apk add zram-init
Configuration
Make service start during next reboot.
# rc-update add zram-init
Configure ZRAM SWAP:
# vi /etc/conf.d/zram-init
For basic ZRAM swap:
- Update from num_devices=3 to num_devices=1
- Change the size0=512 to the desired megabytes (same as available RAM or 8GB, whichever is less)
- Change the default algorithm from zstd to lzo-rle
Warning: The default algorithm zstd does not work with Alpine Linux.10044
Start services:
# rc-service zram-init start
View the ZRAM drive
# cat /proc/swaps
Check Algorithms:
# cat /sys/block/zram0/comp_algorithm
Advanced setups may also add these parameters to /etc/sysctl.conf:
- vm.page-cluster=0
- vm.extfrag_threshold=0
- vm.swappiness=100