$linuxjunkies
>

compressed swap

also: zswap, zram, memory compression

A memory management technique that compresses inactive data in swap space to reduce disk I/O and improve system performance on memory-constrained systems.

Compressed swap uses compression algorithms (typically zstd or lz4) to reduce the size of data written to swap, allowing the system to keep more compressed pages in a fast in-memory pool before writing to slower disk swap.

When the kernel needs to move memory pages to swap, instead of writing them directly to disk, compressed swap compresses the data first. This reduces both disk space usage and the amount of slow I/O operations needed, making swapping less painful on systems with limited RAM.

Example: On a system with 4GB RAM and heavy load, compressed swap might keep frequently swapped pages in a 512MB zram device instead of constantly reading/writing to disk swap, significantly improving responsiveness. Modern implementations like zram and zswap make this transparent to users.

Related terms