There is a difference between swap and paging, but both use the "swap"
space.  Modern memory management and cheap ram have mostly done away with
swapping however paging happens all the time.  The best thing to do is
install sar if not already installed via 'apt-get install sysstat'.  Sar
will give you paging stats, start the service and check the results after a
few hours of normal operation with 'sar -B' and 'sar -S'.  Bottom line,
swap is very bad, some small amount of paging is normal when there is not
enough RAM for everything that is running on the system.  Back when I was
running large UNIX (not Linux) hosts for MRP applications, we sized the the
system RAM so there was never page outs, the same could be accomplished for
a largish Linux box.  Using sar you can gauge how much paging space you
will need.  Most estimates you will find in the literature will be way too
large.  Using a swap file on SSD will allow fine tuning.  With enough RAM
you would not need swap space at all, but you should configure some small
amount to avoid crashes.

On Fri, Jul 28, 2023 at 4:05 PM Keith Lofstrom <[email protected]> wrote:

> Question about swap file vs swap partition.
>
> I have a dozen spinny disks with too many ancient
> distros on too many machines.
>
> I am slowly consolidating to a few Debian 12 Bookworm
> machines with Samsung terabyte SSDs.
>
>
> When large-RAM low-power fast motherboards become cheap
> enough, I will migrate to those.  More RAM may imply
> larger swap areas (a semi-religious debate I hope to
> avoid). I want to be ready if the "large swap" zealots
> win the debate and design software dependent on swap.
>
> SSD swap seems MUCH better than spinny-disk swap,
> very fast access compared to moving a spinny disk head
> across a platter ... though way slower than RAM.
>
> ----
>
> Large SSD swap also facilitates fast hibernate, though
> Debian startup and shutdown are amazingly fast using
> an SSD (10 seconds startup/login, 2 second shutdown).
>
> Perhaps I don't need hibernate-to-swap.
>
> ----
>
> One of my recent SSD experiments resulted in a too-small
> swap partition.  Inept resizing attempts borked the file
> system.
>
> But ... I can also create a huge swap file on a regular
> ext4 file system, and easily up-size the swap file when
> I install more RAM.  Resizing a partition is more complex.
>
> I've read some online debates about swap partitions vs.
> swap files.  Most of the debates are from the spinny disk
> era; the speed tradeoffs have changed radically.
> My main concern is reliability, software compatibility,
> and ease of maintenance rather than maximum speed.
>
> ----
>
> I suspect I will need SOME separate-partition swap, but
> I hope I can get by with a few gigabytes, relying mostly
> on a big swap file, growing that swap file over time as
> I migrate to motherboards and laptops with more RAM.
>
> At 69.9 years of age, I should also minimize complexity,
> deploying systems that I can maintain with an 80 or 90
> y.o. brain someday.  My father-in-law is 105, and his
> Windoze computer took many days to decrapify.  I won't
> have a son-in-law to do that for me.
>
> So, that's a lot of yammering, another sequela of excess
> age.  In summary:
>
> "Optimum SSD swap? ?? ???"
>
> Keith
>
> --
> Keith Lofstrom          [email protected]
>

Reply via email to