This tutorial shows how to enable zswap kernel module to increase usable RAM in your Ubuntu computer or laptop.
…
Swap space can be helpful for computers with limited RAM. But, it’s slow! Too much swap in use will slow down the overall system performance.
As workarounds, Linux includes 2 kernel modules: zram and zswap. Instead of moving inactive pages from memory to disk (swap space), they do similar things by compressing the data into dynamically allocated RAM space.
…
zram creates a block device in RAM, that acts as swap space (or a general-purpose RAM disk). When system needs to swap out inactive pages, zram compress them into the block device. No swap on disk is required.
zswap is a lightweight compressed RAM cache for swap pages. It attempts to compress the pages, that are needed to swap out, and store them into a memory pool in RAM. Poorly compressible data is directly written to disk (swap space). And, when the memory pool is full or the RAM is exhausted, the least recently used page is decompressed and written to disk (swap). A swap space on disk is required!