Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Feb 2023 13:48:47 -0500
From:      "Derek (freebsd lists)" <482254ac@razorfever.net>
To:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Current swap configuration: best practices?
Message-ID:  <5cd5040b-d6c9-7c5f-9eae-e7e8a098eaca@chezmarcotte.ca>

next in thread | raw e-mail | index | archive | help
About to configure some new servers for production, and it feels like 
for this configuration, there is no good reason to enable or provision 
swap.  Would love to understand if anyone has a different viewpoint.

The configuration is such that the disks (NVMe) are only 4-8x the size 
of physical RAM, and there is a lot of RAM + cores (128GB/1TB & 
256GB/1TB).  Working sets will fit easily into RAM.

 From the handbook:
* the swap partition should be about double the size of physical memory 
(RAM)

 From the Architecture Handbook:
* You should have at least 2x the swap space as you have main memory, 
and possibly even more if you do not have a lot of memory.
* You should also size your swap partition based on the maximum memory 
configuration you ever intend to put on the machine so you do not have 
to repartition your disks later on.

Using ZFS:
* enabling mirror swap will break crash dumps

My previous typical setup:
* tweaked bsdinstall to create freebsd-swap partition
* use gmirror + geli to mirror and encrypt swap
* no dumps currently enabled
* zfs mirror + stripe data/root volume

I've reviewed both:

https://forums.freebsd.org/threads/exploring-swap-on-freebsd.78418/

and the message archives.

I found the thread talking about ANON mmap'd pages, curious how those go 
with swap disabled, mmap(2) doesn't mention anything.

It seems like with "large" RAM, no dumps, and "small" NVMe-backed 
storage, there is no reason to enable swap - and certainly not the 
official recommended 2xRAM.  What am I missing here?


Thanks,
Derek



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5cd5040b-d6c9-7c5f-9eae-e7e8a098eaca>