gmirror synchronising is very slow due to frequent metadata updates

Andre Albsmeier andre at fbsd.e4m.org
Sun Nov 19 10:34:33 UTC 2017


I am running a 2 TB gmirror with two disks. I replaced one disk and the
mirror started to synchronise. I noticed that the sync rate was about
50 MB/s which is a lot lower than the more than 120 MB/s which are
possible with this hardware.

The reason for this are the very frequently happening metadata updates
done in sys/geom/mirror/g_mirror.c:

               if (sync->ds_offset_done + (MAXPHYS * 100) < offset) {
                        /* Update offset_done on every 100 blocks. */
                        sync->ds_offset_done = offset;
                        g_mirror_update_metadata(disk);

With MAXPHYS being 128kB this would mean that metadata is updated every
12 MB -- or 4 times a second @ 50 MB/s.

Out of curiosity I changed this to MAXPHYS * 2000 which means that the
updating is done every 240 MB. Now the disks are synchronising with
approx. 105 MB/s...

Is there any reason why these metadata updates are done so often and
what are the risks having them more infrequently (as I do now)?

	-Andre


More information about the freebsd-hackers mailing list