this post was submitted on 17 Sep 2025
27 points (100.0% liked)
Linux
11084 readers
1170 users here now
A community for everything relating to the GNU/Linux operating system (except the memes!)
Also, check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why would you reserve ram for swap???
You’re hindering the OS’s ability to manage memory.
Put swap on disk. Aim for it to rarely be touched - but it needs to be there so the OS can move idle memory data out if it wants to.
Don’t hard-allocate a memory partition for postgres. Let it allocate and free as it sees fit.
Then the OS will naturally use all possible RAM for cache, with the freedom to use more or less for the server process as demand requires.
Monitor queries to ensure you’re not seeing table scans due to missing indexes. Make sure VACUUM is happening either automatically or manually.
It's a useful way of squeezing out a few GB more. Worked wonders on my starved Steam Deck and allowed me to play Cities Skylines smoothly and without crashes.
But on a DB heavy server that is apparently not a good idea. I've switched to a swap file.
There are definitely some unoptimised queries and missing indexes. Lemmy 1.0 will supposedly fix a lot of them.
If you put swap in zram, you are paging from RAM to RAM. May as well just not use swap and save the cycles.
The point is compression.
zswap is specifically built to this end and far better suited to it.
zram is great, but it is simply a ramdisk and inappropriate to ops task. It cannot dynamically grow/shrink or deal with hot/cold pages.
zswapis not better than modernzramin any way. And you can set up the latter with writeback anyway.But that's not OP's problem since "swap gets hardly touched" in OP's case.