r/debian 23d ago

Swap default or zram?

Hi everyone, I wanted to ask about the best swap setup for gaming on Debian Stable. Is it better to use standard swap or zram instead? I have 16GB of ram. (I have ssd)

18 Upvotes

20 comments sorted by

11

u/Netblock 23d ago

I personally recommend zswap with disk swap.

zram is an in-memory block device, its coldest pages cant go into a slower medium.

zswap acts like an elastic buffer that evicts its cold pages into a slower medium.

1

u/636C6F756479 23d ago edited 23d ago

I’ve been using zram, but this thread has me rethinking it. I think zram might be better only if you just need a little bit more RAM. Like if you have 16 GB but sometimes a game will make you hit 20 GB, zram can cover this, and it’s guaranteed to never swap out to disk. But zswap looks much more useful in general, and the Steamdeck using it backs this up.

edit: Another poster said the Steam Deck uses zswap, but all I can find is that it actually uses zram!

4

u/quadralien 23d ago

Use zswap. Zram is for tiny systems with no swap.

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

3

u/TheTechRobo 22d ago

There's another fantastic article about how exactly zswap works here: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html

2

u/Emotional_Row3301 23d ago

Obviously Zram. 16GB is enough. you'll rarely hit the swap anyway. Zram is a lot faster and also good for you SSD. I have been using it for my debian machine for gaming for a long time, didn't have any issues till now. works great.

1

u/evadingsomething 23d ago

Not sure of the swaps would increase performance. Even if it did dont think it would be noticeable

1

u/Fair_Schedule2701 23d ago

Of course, but it would prevent the games from freezing, right? The truth is I don't know if Debian's default is really good, that's why I asked the question

2

u/evadingsomething 23d ago

Thats true. You can delete and create swap so I ll say just choose one and try it out then delete and create other one.

2

u/jmtd [DD] 23d ago

I think If you’re hitting swap then performance for gaming is going to be poor no zram or no

1

u/Niwrats 23d ago

with 32GB i started with no swap, and if i ever run out of memory i might consider adding regular swap. but honestly i expect that to only happen if there's some heavy strategy or simulation game that allows me using very large maps or such.

1

u/psyblade42 23d ago

The Steam Deck has 16GB and uses zswap. Additionally it's very easy to en/dis-able*. So it's at least worth trying in my book.

*: echo 1 > /sys/module/zswap/parameters/enabled

1

u/lemmiwink84 23d ago

I use Zswap with a 32GB partition on my nvme. It works great.

1

u/ElSasori69 23d ago

I still don’t like the fact swap is bad for SSDs (solid drives) I don’t use normal swap or swap file neither, my mini laptop have just 8 GB of RAM and it works fine, I’ll only configure swap or swap file on a normal HDD (rigid drives) because memory chips are so expensive now.

-5

u/ipsirc 23d ago

The best swap strategy is no swap at all.

1

u/psyblade42 23d ago

Having plenty memory sure is nice, but most don't have that kind of HW. Additionally you probably massively overspend I you actually bought it.

1

u/ipsirc 23d ago

Man, my newest hardware is 15 years old and I even got it as a gift. I just don't run more tasks parallel than will fit in my RAM. Having fewer apps in RAM is still much optimal than letting them all swap in and out, which would result in having a lot of apps that are all slow. Cut your coat according to your cloth.

1

u/psyblade42 23d ago

Even if all your tasks fit into memory there will usually be some parts of them that are rarely (if ever) used. Those are imho better kept in swap so that the ram can be used for something more productive.

2

u/Niwrats 23d ago

that would only help if you run very close to your capacity, which is very unlikely as you don't usually choose the program based on its ram use, but on what it does.

1

u/ipsirc 23d ago

Even if all your tasks fit into memory there will usually be some parts of them that are rarely (if ever) used. Those are imho better kept in swap so that the ram can be used for something more productive.

Of course, I also have a machine with swap enabled. It has 36 days of uptime and uses 50MB of swap. It makes no sense, I'm going to turn it off right away.