Re: Question about logbsize default value

Dave Chinner
2019-10-24T21:50:34Z

On Wed, Oct 23, 2019 at 11:40:33AM +0200, Gionatan Danti wrote:
> Hi list,
> on both the mount man page and the doc here [1] I read that when the
> underlying RAID stripe unit is bigger than 256k, the log buffer size
> (logbsize) will be set at 32k by default.
>
> As in my tests (on top of software RAID 10 with 512k chunks) it seems that
> using logbsize=256k helps in metadata-heavy workload, I wonder why the
> default is to set such a small log buffer size.
>
> For example, given the following array:
>
> md126 : active raid10 sda1[3] sdb1[1] sdc1[0] sdd1[2]
> 268439552 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU]
> bitmap: 1/3 pages [4KB], 65536KB chunk
>
> running "fs_mark -n 1000000 -k -S 0 -D 1000 -N 1000 -s 16384 -d
> /mnt/xfs/" shows the following results:
>
> 32k logbsize (default, due to 512k chunk size): 3027.4 files/sec
> 256k logbsize (manually specified during mount): 4768.4 files/sec
>
> I would naively think that logbsize=256k would be a better default. Am I
> missing something?

Defaults are for best compatibility and general behaviour, not
best performance. A log stripe unit of 32kB allows the user to
configure a logbsize appropriate for their workload, as it supports
logbsize of 32kB, 64kB, 128kB and 256kB. If we chose 256kB as the
default log stripe unit, then you have no opportunity to set the
logbsize appropriately for your workload.

remember, LSU determines how much padding is added to every non-full
log write - 32kB pads out ot 32kB, 256kB pads out to 256kB. Hence if
you have a workload that frequnetly writes non-full iclogs (e.g.
regular fsyncs) then a small LSU results in much better performance
as there is less padding that needs to be initialised and the IOs
are much smaller.

Hence for the general case (i.e. what the defaults are aimed at), a
small LSU is a much better choice. you can still use a large
logbsize mount option and it will perform identically to a large LSU
filesystem on full iclog workloads (like the above fsmark workload
that doesn't use fsync). However, a small LSU is likely to perform
better over a wider range of workloads and storage than a large LSU,
and so small LSU is a better choice for the default....

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com