Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Apr 2016 17:26:53 -0500
From:      "Eric A. Borisch" <eborisch@gmail.com>
To:        Miroslav Lachman <000.fbsd@quip.cz>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>
Subject:   Re: How to speed up slow zpool scrub?
Message-ID:  <CAASnNnowU0he_2BFqkb-ZTNBVn00wc8Qt7CWSPVQT%2BuCKaJSKg@mail.gmail.com>
In-Reply-To: <571F62AD.6080005@quip.cz>
References:  <571F62AD.6080005@quip.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 26, 2016 at 7:44 AM, Miroslav Lachman <000.fbsd@quip.cz> wrote:
> Hi,
>
> is there any way to make zpool scrub faster?
> We have one older machine with CPU Pentium(R) Dual E2160 @1.80GHz, 5GB of
> RAM and 4x 4TB HDDs. It is just a storage for backups for about 20 machines.
> Scrub is scheduled from periodic each 30 days but it takes about 4 days to
> complete and everything during scrub is slow. Backups takes 8 hours instead
> of 5 (made by rsync), deleting of old files is even more slower.
>
> The backups are made every night from the midnight to morning, the machine
> is idle for the rest of the day.
>
> Is there any tuning to make scrub faster in this idle time?
> Or is it better to do it other way - slower scrub with even lower priority
> taking for about one week but not affecting time of normal operations? (is
> it dangerous to have scrub running this long or reboot machine during the
> scrub?)

It's likely easier to make scrub slower (but rsync faster) when the
system is not idle, but hopefully no slower otherwise.

I would start with increasing the vfs.zfs.scrub_delay (in ticks;
typically 1/1000 of a second) settings to reduce scrub's impact to
other IO this without impacting resilvers. (Expect longer total time
as it will scrub less during rsyncs.) You can also increase
vfs.zfs.scan_idle if scrub_delay isn't enough, but do note that
vfs.zfs.scan_idle impacts resilvers, too -- so make sure you don't
also increase vfs.zfs.resilver_delay, or you may get very slow
resilvers during IO.

The logic for this is in dsl_scan.c [1] -- look there for the final
word on what the different parameters do; there are a number of
informative comments throughout the file if you are not into the code
itself.

See also vfs.zfs.vdev.*_max_active and vfs.zfs.vdev.*_min_active, if
you are really want more knobs to try.

It's might also be worth trying '/usr/local/bin/perl
/usr/share/dtrace/toolkit/hotkernel' to see what the kernel is up
to...

 - Eric

[1] https://svnweb.freebsd.org/base/releng/10.3/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c?view=markup
or
https://github.com/freebsd/freebsd/blob/releng/10.3/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAASnNnowU0he_2BFqkb-ZTNBVn00wc8Qt7CWSPVQT%2BuCKaJSKg>