ZRAM Swap Planner

Size a zram swap device from RAM, a device share and an expected compression ratio, and see how much RAM the swap really returns.

The device size is the uncompressed swap space (the kernel writes it to disksize). The memory limit caps the RAM zram may use for compressed data; 0 leaves mem_limit unset. Distros commonly size the device at 50 % or 100 % of RAM.

RAM freed
—
Set the RAM, the device size and the compression ratio above.

— RAM used— freed
What this setting puts in RAM
Swap device (disksize)
Pages stored
Compressed data
Metadata (about 0.1 % of the device)
RAM used
RAM freed
Memory limit (mem_limit)
Ratio to fill the device
Example setup
—

zram keeps swapped pages compressed in RAM instead of writing them to a disk: a page swapped out frees its uncompressed size and costs its compressed size plus a small metadata table, so the ratio decides whether the device is a saving at all. The kernel notes there is little point sizing a device above twice RAM at the expected 2:1, because the metadata is allocated for the whole device whether or not it fills. Incompressible data compresses at about 1:1 and gains nothing; check mm_stat (compr_data_size against orig_data_size) on a running system to see the real ratio. zswap, which keeps a compressed cache in front of a disk-backed swap, is a different mechanism and is not modelled here. Everything is computed in your browser; nothing is sent anywhere else.