Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderThis is bad advice when the swap is backed by spinning disk rather than SSD, in large part because paging in once the problem is solved is not aggressive enough. Let me make it concrete: say 1 GiB of your application's RAM gets swapped out then is later paged in only as needed (4 KiB pages) with no readahead. Now the application's VM space is a minefield: there are up to 262,144 times it can stall for a ~10 ms…
Swap engineering is definitely way more complicated than the article lets on. What people often don't realise is that Linux distinguishes between dirty and clean memory, with dirty memory not reflected in swap, and clean memory already stored somewhere on disc, and program code is counted as clean memory that just happens to live somewhere other than swap. Therefore, under memory pressure (especially if you set swappiness to zero), you will be preferentially swapping out your program code (because it…
Don't forget Part 2: https://haydenjames.io/linux-performance-almost-always-add-s... zram is cool, and I've noticed Fedora uses it out of the box. Much better than regular swap space on a disk. https://wiki.archlinux.org/title/Improving_performance#zram_... Interestingly, my 64GB desktop has 50GB available between free and caches, yet has 95MB of swap space used (out of 8GB zram). How can I tell which process is swapped out? Probably something which I haven't ever needed since I've booted the PC.
Counter-point, why swap is almost never required. [1] We don't have swap on over 30k servers. If you must use it, ensure it is encrypted. [1] - https://github.com/ohdns/sysctl_and_thp_test
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 137
- Total comments
- 192
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2017-07-30 | No SWAP is hurting your Linux performance | ashitlerferad | 6 | 0 |
| 2017-07-31 | Linux Performance: Why You Should Almost Always Add Swap Space | dtx1 | 2 | 0 |
| 2017-08-08 | Linux Performance: Why You Should Almost Always Add Swap Space | ashitlerferad | 3 | 0 |
| 2017-12-18 | Linux Performance: Why You Should Almost Always Add Swap SpaceFirst breakout | ashitlerferad | 46 | 109 |
| 2019-04-17 | Linux: *Almost* Always Add Swap Space | ashitlerferad | 8 | 3 |
| 2019-04-18 | Linux Performance: Why You Should Almost Always Add Swap Space | Supermighty | 3 | 2 |
| 2019-07-19 | Almost Always Add Swap SpaceBest thread · Latest 20+ point return | ashitlerferad | 52 | 75 |
| 2020-10-12 | Almost always add swap space | ashitlerferad | 4 | 0 |
| 2021-12-02 | Almost Always Add Swap Space | ashitlerferad | 11 | 3 |
| 2023-09-25 | Almost Always Add Swap (Linux) | ashitlerferad | 2 | 0 |
