zram creates block device that can be used for swap or RAM disk. Typical use case, assisted by readily available tooling is to use it as higher-priority swap. Written blocks are compressed, resulting in "more swap" (for easily compressible data).
Note: zram and zswap will interfere with each other, if both are used.
Benefits
- RAM-only (fast)
- Easily compressible data is stored in RAM more efficiently
- Independent from swap configuration, simply act as higher-priority swap
Issues
- Adds CPU workload
- Once full, fall backs to regular swap (if present) - Least Recently Used might end up on RAM
sudo apt install zram-config
System restart is necessary for zram-config to handle zram configuration as swap automatically.
Use of zram of swap can be verified without additional packages using cat /proc/swaps
zramctl
zramctl --output-all