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

As someone who has servers with swap on NVMe; it barely matters. Sustained swap thrashing is a bad scenario no matter how you put it and it'll just tank performance. Get more RAM. SWAP I/O should never have any sustained background level, it should ideally only spike every few minutes or so and remain low level to zero otherwise.

SWAP on SSD or NVMe is still miles better than HDD, you can notice the difference when the swap is being used.




But that assumes that someone notices the swap -- when I was new at a former last job, I asked why the drive activity light was always on on the server marked "finance". The answer was "Who knows!? That's some special software that finance uses, when it gets slow they tell us and we reboot it". It had been like that for more than a year.

Turns out that the app grew huge over time and the machine would swap like crazy and would eventually slow to a crawl. The machine was already maxed out on RAM, so we added a service to restart the app twice a week. Finance said it took hours off their month-end work, they thought the app was just slow.


You can monitor swap usage; in htop you can turn on the SWAP, PERCENT_SWAP_DELAY and M_SWAP columns, telling you exactly how much of a process is in swap, how large that is and the delay the process experiences due to swap.

You can also monitor swapping activity in iotop. If need be, this can also be written on third party tools, the interfaces are exposed by the kernel after all.

Oh and you can use the modern PSI monitoring of the kernel to measure how much pressure a subsystem is experiencing, so you can restart services way before you'd even notice the swapping on other tools.


Yes, you can monitor a lot of things, but whether everyone does is a different question.


People should if they are interested in performance. I log about 1TB/day of metrics data for the applications I'm responsible for and developed a mantra for it; It's better to have a shitton of metrics logging and not need them than have no metrics logging and having to set it up when everything is broken already.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: