4 ms·
This article is always thrown around if the topic comes up, at least in my experience it's wrong or at least not useful for my usecases (general purpose web hos
by nisa 4y ago
This article is always thrown around if the topic comes up, at least in my experience it's wrong or at least not useful for my usecases (general purpose web hosting stuff in all kinds of flavours)
- swap on spinning rust outright kills the system if memory is low. it's a full blown crash.
- swap on ssd act's much the same
- zram swap stalls and slows down the system for several minutes
I just raise vm.min_free_kbytes to make the oom killer faster and disable swap. At least the machines don't crash hard this way.
- AshamedCaptain 4y agoYou are either abusing the word "crash" or otherwise make a very dubious assertion here.
- nisa 4y agocrash as in it's not recoverable using ssh - machine only responds to ping and needs a hard reset.
- andrewjf 4y agoWhich is exactly the situation you never, ever want a server in. So it’s actually worse than a “crash” Me and my team removed swap on tens of thousands of machines cause we were sick of dealing with this. We wanted the machines to fail hard and fast and not go into a state where it’s doing only a minuscule amount of actual work while trying to recover.
- cosarara 4y agoAnd I think that, sadly, it's not even a full solution, because linux can manage to get thrashing even without swap. It pages in and out things like memory mapped files or the content of executables of stopped processes. See for instance: https://serverfault.com/questions/898388/how-to-prevent-kernel-i-o-thrashing-in-absence-of-swap-memory-on-linux https://serverfault.com/questions/898388/how-to-prevent-kern...
- jjoonathan 4y agoWorse than killing the system, it slogs the system, locking it in a state where it doesn't function and doesn't recover.