Zswap: Boosting Linux Performance
Introduction
First of all: Happy New Year 2025!!
Zswap functions like a swap file but on steroid:
compressed RAM-based swap cache for Linux, reducing disk I/O and improving performance
External References
A couple of references on Zswap and Zram:
- Zswap
- Zram
An excellent askubuntu post summarizing them:
If you require references in video format:
I'm keeping this post short as the external refs above should be more than enough to get you started configuring your own zswap setup! No need to repeat what's been covered by other articles / references.
My config
I'm using lz4 as it is the fastest compression algorithm, while zsmalloc strikes the best balance of high performance and high compression ratio. If you need higher compression ratio at a lower performance, you can use: lzo as compressor and z3fold as the zpool.
To verify your config is active and running, use this command:
sudo dmesg | grep "zswap"
If you receive a similar output especially you see zswap.enabled=1 that means you've successfully setup and activated zswap on your system.