On Sat, 23 Mar 2024, Michael Ewan wrote:

Some swap is necessary but not the RAM+2GB or other calculations, those
kinds of recommendations are based on very old memory management routines.

You can start with a swap file for safety and then measure actual memory
use under actual work loads over a period of time, you can add/remove swap
files as necessary rather than creating a swap partition (look at the
swapon man page).

Using SAR you can get all the information you need.  Ages ago when we were
sizing some big iron we ran SAR over a period of time and sized the RAM
(very expensive at the time) so the machine NEVER paged out.  Paging stats
are far more important than swap stats, a machine pages all the time but
should never swap, swapping is very expensive and indicates a machine that
has pathetically small RAM.  You will probably see some page outs (page in
is fine since starting a process is a page in), so you can size your swap
space based on the paging needs of the current configuration.

Michael,

Thanks for makeing me aware of SAR.

Germene to all swap partition size justifications might the solution be
relative to use and memory size alone? If a host can support 16GiB (e.g., on
a laptop) or 64GiB (on a desktop) but there's only one or a few concurrent
users I wonder whether any swap partition would be necessary. Perhaps
running a spatio-temporal statistical or multi-dimentional hydraulic model
might require a lot of memory (unless it supports threads, which most do
nowadays) might benefit from a swap partition. And then, most storage
devices (hdds and ssds) are large enough that a swap partition of installed
RAM plus 2 GiB would not hinder application and data storage space.

Regards,

Rich

Reply via email to