Skip to content

Instantly share code, notes, and snippets.

@kekneus373
Created February 14, 2026 21:56
Show Gist options
  • Select an option

  • Save kekneus373/ce59e817e4bfede75cf99e3969e13a38 to your computer and use it in GitHub Desktop.

Select an option

Save kekneus373/ce59e817e4bfede75cf99e3969e13a38 to your computer and use it in GitHub Desktop.
[AI Explanation] Zswap Vs Zram - Which To Use?

Based on the search results, here's a breakdown of zswap vs zram:

Key Differences

Zswap is a compressed cache that works alongside a traditional swap device (on disk/SSD). When RAM fills up, pages are compressed in memory first, and when the compressed pool fills, the least recently used pages are written to disk swap.[1][5]

Zram creates a compressed RAM disk that acts as swap entirely in memory, with no disk swap required by default (though it can be configured with a backing device).[1][5]

Which Should You Use?

Use zswap if:

  • You have a swap device on HDD/SSD[4]
  • Your swap usage is unpredictable or exceeds 20-30% of physical RAM[2]
  • You have fast NVMe storage[2]
  • You want better performance under heavy memory pressure[1]

Use zram if:

  • You have no disk swap device[4]
  • Your swap usage is occasional and stays within ~20-30% of RAM[2]
  • You want a simpler, zero-config solution[4]

Important Notes

With 32GB RAM like your ThinkPad, most users recommend zswap with 4-8GB of disk swap for optimal performance.[1] Zswap scales better when memory pressure is high, while zram can cause severe performance drops when it fills up and needs to spill to disk.[1][2]

Note that Arch Linux enables zswap by default, and you should not use both zswap and zram simultaneously.[1]

Sources:

1 - https://www.reddit.com/r/archlinux/comments/1ivwv1l/zram_vs_zswap_vs_swap/

2 - https://linuxblog.io/zswap-better-than-zram/

3 - https://superuser.com/questions/1727160/zram-vs-zswap-for-lower-end-hardware

4 - https://askubuntu.com/questions/471912/zram-vs-zswap-vs-zcache-ultimate-guide-when-to-use-which-one

5 - https://www.reddit.com/r/linux/comments/11dkhz7/zswap_vs_zram_in_2023_whats_the_actual_practical/

6 - https://alandoyle.com/blog/swap-vs-zswap-vs-zram/

7 - https://en.wikipedia.org/wiki/Zswap

8 - https://forums.linuxmint.com/viewtopic.php?t=450898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment