Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Feb 2020 16:55:52 +0100
From:      Polytropon <freebsd@edvax.de>
To:        tech-lists <tech-lists@zyxst.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: questions about swap (partition and file)
Message-ID:  <20200211165552.e122bf2c.freebsd@edvax.de>
In-Reply-To: <20200211155009.GA9715@bastion.zyxst.net>
References:  <20200211155009.GA9715@bastion.zyxst.net>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Tue, 11 Feb 2020 15:50:09 +0000, tech-lists wrote:
> Which is it better to have - swapfile partition or swapfile?
> 
> I have both, on a SSD. Thing is, I can write 10x faster to the
> file than I can
> to the partition. With a 512b block size, it can write at 17MB/s
> to the
> partition, and about 120-130MB/s to the swapfile, as reported by dd.

Probably a partition is better because it saves the subsystems
accessing it to deal with the filesystem layer. A swap device
does not have a filesystem, and it's not under VFS control, so
no overhead of that kind.

However, it is possible to "emulate" a swap device with a file,
and there are probably several ways to do this (for example,
virtual node: mdconfig + swapctl, also possible as "on demand"
solution where space will only be claimed when there's an
actual need for it).



> Historically, ISTR that it was recommended to have several swap
> partitions on
> the fastest disks available, and that swapfile was slower than
> a partition
> because of something like fat translation.

It was also suggested to make the swap partition = 2 x maximum
RAM of machine... :-)



> Is this still the case nowadays?
> Is there a better way of measuring swap speed than dd?

I'm not sure. It probably depends on the swapping behaviour
implied by your actual workloads.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20200211165552.e122bf2c.freebsd>