On Fri, Feb 28, 2025 at 9:12 AM segaloco via TUHS <
tuhs@tuhs.org> wrote:
On Friday, February 28th, 2025 at 8:04 AM, Dennis Boone <drb@msu.edu> wrote:
> > I’m probably a lost soul on this issue, but swap space is just a way
>
> > to turn program bugs into performance problems.
>
>
> You're hardly the only one. Some years ago, running Linux web and
> database servers, I quit creating swap space. A runaway program would
> turn the system into an infinite game of shuffle-the-pages well before
> the OOM killer actually decided to kill something, and in that state,
> one couldn't even reboot. This expanded the time window of "broken"
> from tens of seconds, and perhaps a service restart, into tens of
> minutes and a power button recovery. Every #$%^&* time.
>
> De
I've read several bits of guidance lately suggesting avoiding swap due to the increasing prevalence of solid-state memories. The assertion is that I/O heavy swapping, especially if you get into a thrashing state, is liable to age current storage technologies much more than it would have in the platter disk era. I've heard contrary opinions that it isn't as large of a liability in reality. I haven't settled on one or the other, I keep a swap file around on the microSD that runs my RPi, but I've only needed to swapon, like OP, when compiling gcc.
Swapping to flash can be fine. The days when a "spot" could be worn out are 20 years in the past. If you use it as a "shock absorber" to cope with transient loads, there's no issues.
However a lot depends on which kind of flash you have, you might have trouble if the load is constant. Today there's a wide range of flash drives. Ranging from < .1DWPD drives (you can't write even 10% of the drive's capacity in one day w/o wearing it out in the warranty period) to 3, 5 or 10 DWPD drives. 0.3 and 1.0 seem popular in the consumer / prosumer / low-end-datacenter space. Those can be a problem if you are constantly swapping (but again are fine for coping with transients).
The MicroSD is likely to be closer to the .1-.3 DWPD (unless you bought an expensive one).
Warner