Hacker News new | past | comments | ask | show | jobs | submit login

>1. Swap thrashing can bring the system into a completely unresponsive state.

This can be prevented using earlyoom (which is packaged in most distros):

https://github.com/rfjakob/earlyoom

It's probably too difficult to fix the underlying design errors, e.g. fork() duplicating the process's entire address space, thus requiring overcommit and copy-on-write, but losing only one process beats losing all of them. earlyoom should be enabled by default.




Or simply disable swap if you have enough RAM. I've been running without swap since 2014 on a 16 GB laptop. I upgraded to 32 GB a couple of years later when I started to routinely use at least 12 GB. At least one browser and editor window per virtual desktop (one VD per customer plus a couple for me), docker, virtualbox, slack, thunderbird, etc.


Don't do this. Disabling swap is bad idea: https://chrisdown.name/2018/01/02/in-defence-of-swap.html


In practice the benefits of swap mentioned in that article almost never happen on desktop use. I used to use swap on my last install and it was pretty much never used. I don't bother with swap anymore. Server may be different game though.


Not really. While there are still problems without swap, all swap does is move that problem further away while slowing down some things in the meantime.


You can still have thrashing without a swap partition/file: as memory pressure increases, the kernel will flush disk cache and buffers, slowing down operations that need them again. In the extreme case this can mean the program code you are executing being evicted from ram only to be re-read page by page for many times until the kernel finally decides to kill whatever was eating all the ram.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: