Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Feb 2018 16:13:25 +0000
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Swap on SSD
Message-ID:  <bfd82845ece3604806329336c58610ed@roundcube.fjl.org.uk>
In-Reply-To: <26877DEB-034F-422B-918F-2A0D1C381537@kreme.com>
References:  <26877DEB-034F-422B-918F-2A0D1C381537@kreme.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2018-02-04 11:19, @lbutlr wrote:
> I have a machine that has dual SSDs in it and no spinning disks.
> FreeBSD has a 4GB (or so) swap partition that it created on the
> installation of FreeBSD 11.1.
> 
> Isn't this going to cause problems for the SSD to have swap constantly
> working the drive?

Assuming you have enough RAM, I'd turn it off. "swapoff -a" if you can't 
wait and edit fstab if don't mind a reboot.

You could use gpart to return it to normal use.

But there's more to it than that. And all SSDs are definitely NOT 
created equal. Some cost 10x as much as others and are designed to be 
pounded. Others are cheap and expect to be treated gently. If you're 
using an enterprise SSD it probably won't matter, but you'd probably 
know it if you were.

FreeBSD doesn't actually swap these days; uses demand paging. This means 
that blocks of RAM that are hardly ever used can get copied to disk. 
This may include some stuff that's only accessed a few times a year, but 
would otherwise be occupying precious RAM that would be much more useful 
as a disk cache. That said, FreeBSD tends not to page out except as a 
last resort - probably a mistake but I can't prove it.

It's perfectly feasible to run with no swap. I sometimes think the 
gradual slow-down due to lack of caching/buffer space is preferable to a 
thousand page-faults/second.

But what works for you depends on the workload and available RAM.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bfd82845ece3604806329336c58610ed>