Hacker News new | ask | show | jobs
by na85 1984 days ago
Doesn't swap adversely impact the longevity of one's solid state drive?
3 comments

Only if it's used.

Not being facetious -- if you operate entirely within RAM (as if you had disabled swap), then it won't really be used much.

For linux this is not (always) true. How about FreeBSD? Any sources?
The article says "It is thus common to see moderate swap space usage even when plenty of free memory is available", with an explanation above. So it sounds like it's not always true for FreeBSD either.
The notion there is that at some point in the past free memory was scarce, so the kernel swapped out some pages, and that swap space may still be in use long after the shortage is alleviated. FreeBSD won't swap anything out unless there's a shortage of free pages.
You can set the swapiness of both systems if you want for it to be true. Modern SSDs won’t last a second longer without a swap and now a days of swap files there’s really no excuse to not have one.
I don't think this is realistically an issue unless you have heavy server workloads which constantly blow the memory ceiling of your node and then hammer it hard. Hammering it as in actually actively writing and reading from the pages of memory in swap, which is also difficult as MRU pages are should be kept in RAM. At that point you really should be monitoring it and stick some more memory in it anyway. For end users desktops and laptops it'd be pretty hard to kill a (quality) drive dead in under 10 years at the moment based on longevity estimates even with some swap usage.

This is one reason I went with an 8Gb RAM Mac recently. If I go into swap territory occasionally it's not really a big issue. As yet as a terminal node, which is what it really is, I barely ever touch swap even with a ton of things open.

If swap can reduce the overall amount of disk I/O through more effective use of memory for disk caching, then it might actually increase longevity of SSD drives.