Situation: to study the effect of zram's virtual memory compression (wiki) on memory's size and its speed; when swap is not on HDD/SSD; use zswap if you want to have swap on HDD/SSD
Motivation: I experience no effect on the memory's size but increased amount of errors from systemd/... with runit i.e. possible stability issues with the compression, although paging should be avoided more
Code
# http://askubuntu.com/a/800645/25388
modprobe zram
echo lz4 > /sys/block/zram0/comp_algorithm
echo 4G > /sys/block/zram0/disksize
mkswap --label zram0 /dev/zram0
swapon --priority 100 /dev/zram0
Characteristics
Command
cat /sys/block/zram0/orig_data_sizegives4096.RAM full and swap full. So computation ends when total memory consumption reaches the high about 20 GB, failing the computation.
Command
swaponbaed oncat /proc/swapsNAME TYPE SIZE USED PRIO /dev/sda3 partition 8G 0B -1 /dev/zram0 partition 4G 0B 100Command
free -mtotal used free shared buff/cache available Mem: 7925 1390 5465 172 1069 6074 Swap: 12226 0 12226Command
df -k | grep sda2about current memory use in SSD, possibility to extend it for Swap.Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 108299224 76880916 25893932 75% / % df -h /dev/sda2 104G 74G 25G 75% /
Test code: any memory-heavy Matlab computation.
Output: the size of matrix does not increase with the implementation. Expected output: increase in memory size.
System: Linux Ubuntu 16.04 64 bit
Hardware: Macbook Air 2013-mid

free -mwould be more useful. – cas Jul 24 '16 at 09:30swaponwithout the-soption gives more useful output. – cas Jul 24 '16 at 09:31swapon(or in /etc/fstab). AFAIK, to change the priority of a swap device you have to runswapoffon it first, and thenswaponagain with the new priority. – cas Jul 24 '16 at 10:25zramand its effect on the size of total RAM size? I need to compute with big matrices. – Léo Léopold Hertz 준영 Jul 24 '16 at 10:28