2014-07-06, 13:21
Thanks Milhouse for adding Zram. Working here brilliantly. For anyone wanting to enable and try it here's my autostart.sh -
From my really quick test it looks like using LZ4 compression offers faster compression speeds but a lower compression ratio than LZO. I would rather have speed and performance over trying to squeeze as much into ram as I could.
One thing I might play around with later is the swappiness value. From what I understand, it's set low so not to swap as often to a physical swapfile to save on sd writes but that would not be a problem using Zram as the swap is contained entirely in ram so we can read/write as much as we want.
Code:
#!/bin/sh
#
# Autostart.sh
# Load Zram Module
modprobe zram
# Set Zram Compression (default lzo)
echo lz4 > /sys/block/zram0/comp_algorithm
# Set Zram Size
echo 64M > /sys/block/zram0/disksize
# Optimize Read Ahead (default 128)
echo 1024 > /sys/block/zram0/bdi/read_ahead_kb
# Enable Zram
mkswap /dev/zram0
swapon /dev/zram0
From my really quick test it looks like using LZ4 compression offers faster compression speeds but a lower compression ratio than LZO. I would rather have speed and performance over trying to squeeze as much into ram as I could.
One thing I might play around with later is the swappiness value. From what I understand, it's set low so not to swap as often to a physical swapfile to save on sd writes but that would not be a problem using Zram as the swap is contained entirely in ram so we can read/write as much as we want.