Re: measuring swap partition speed

From: Warner Losh <imp_at_bsdimp.com>
Date: Sat, 16 Dec 2023 18:16:31 UTC
On Sat, Dec 16, 2023 at 5:24 AM void <void@f-m.fm> wrote:

> On Fri, Dec 15, 2023 at 08:41:10AM -0700, Warner Losh wrote:
>
> > What's the underlying hardware?
>
> my apologies, I should have supplied this detail initially.
> It's a spinning rust TOSHIBA MQ01ABD100
>
> > So the good news, kinda, is that if this is spinning rust, your swap
> > partitions are
> > on the fastest part of the disk. I'd expect 1 that's 12G would work
> better
> > than 6 that
> > are 2G since you'd have less head thrash. Parllelism with multiple swap
> > partitions
> > works best when they are on separate spindles.
>
> ok that's easily fixable. It was originally one big 12G swapspace.
> The reason it's split into 6 is for testing purposes. I've noticed when
> swap gets used there's the marked slowdown even if the process using
> it has paused. So I've found that using swapoff then swapon puts these
> processes back into active memory and the system sluggishness goes,
> for a short while until swap gets used again. With the swapspace split,
> I can swapoff/on each partition individually. If there's 2GB free mem
> and 3GB on swap, I can swapoff a couple of partitions, swapon them again
> then swapoff/on the relatively full partition to get total swap use
> back to 0.
>

I'm not sure that makes a lot of sense. Having one big partition with
swap in use just means there's processes in the system that aren't
paged into memory. That's totally fine most of the time. It makes for
a larger RAM working set for everything else. At least that's the theory..
When you're exceeding the amount of RAM by a lot, weird things are
going to happen... sounds like you are trying to cope as best you can
with memory shortages...  The best way around that is either to get more
ram, or put less load on the system.


> >The bad news is that your disk may be fine. I'd expect that as the ZFS
> >partition fills up,
> >the seek size will increase as greater distances have to be traversed to
> >get back
> >to the swap space. There's a sweet spot of a few tens of GB that drives
> >usually can seek
> >far faster than longer throws...
>
> (not an SSD)
>
> TYVM for the fio tip. Am building it now.
>

Great! Be careful with it: it writes to partitions.


> I'm wondering really if I should reprovision this rpi4 for UFS rather
> than zfs. Have had great positive experience with zfs as data (ie, booting
> ufs, zfs is a non-bootable single disk or array), less than ideal with
> zfs-on-root. There's periodic backups and not much call for this device to
> utilise zfs functionality that can't be provided on hardware with more
> horsepower.
>

You can try that. I think you'll find that ZFS puts more memory  pressure
on your system. But the RPi4 likely has enough RAM to not be terrible
(though
given your swap issues, maybe not). UFS might be better, especially if
you don't need the features of ZFS for this system.

Warner


> it must be said though that FreeBSD is *very stable* on this hardware.
>
> --
>
>