←back to thread

150 points shaunpud | 1 comments | | HN request time: 0s | source
Show context
fh973 ◴[] No.45060597[source]
Swap on servers somewhat defeats the purpose of ECC memory: your program state is now subject to complex IO path that is not end-to-end checksum protected. Also you get unpredictable performance.

So typically: swap off on servers. Do they have a server story?

replies(6): >>45060665 #>>45060768 #>>45062143 #>>45062478 #>>45062741 #>>45110791 #
abrookewood ◴[] No.45060665[source]
That's a really good point that had never occurred to me.

Edit: I think that the use of ZFS for your /tmp would solve this. You get Error Corrected memory writing to an check-summed file system.

replies(1): >>45060900 #
yjftsjthsd-h ◴[] No.45060900[source]
ZFS /tmp is probably fine, but swapping to ZFS on Linux is dicey AIUI; there's an unfortunate possibility of deadlock https://github.com/openzfs/zfs/issues/7734
replies(2): >>45061284 #>>45061712 #
cromka ◴[] No.45061712[source]
So maybe another filesystem with heavy checksums could be used? Btrfs or dm-crypt with integrity over ext4?
replies(2): >>45061804 #>>45062874 #
tatref ◴[] No.45061804[source]
Why not dm-integrity?
replies(1): >>45065608 #
1. yjftsjthsd-h ◴[] No.45065608[source]
https://wiki.archlinux.org/title/Dm-integrity

> It uses journaling for guaranteeing write atomicity by default, which effectively halves the write speed.

That seems like a poor fit for swap IMO.

https://www.kernel.org/doc/html/latest/admin-guide/device-ma... says,

> There’s an alternate mode of operation where dm-integrity uses a bitmap instead of a journal. If a bit in the bitmap is 1, the corresponding region’s data and integrity tags are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated. The bitmap mode is faster than the journal mode, because we don’t have to write the data twice, but it is also less reliable, because if data corruption happens when the machine crashes, it may not be detected.

It's not clear to me if that would be okay for swap (as long as you don't hibernate, maybe) or if it's sufficiently protected from corruption.