On Tue, Feb 23, 2021 at 5:49 AM Luca Ferrari <fluca1978@xxxxxxxxx> wrote: > I'm running a virtual machine with FreeBSD 12.2, PostgreSQL 12.5 and > UFS as filesystem. > I was experimenting with fsync = off and pgbench, and I see no > particular difference in tps having fsync enabled or disabled. > Now, the same tiny test on a linux box provides a 10x tps, while on > FreeBSD is a 1% increase. > I'm trying to figure out why, and I suspect there is something related > to how UFS handles writes. Do you have WCE enabled? In that case, modern Linux file systems would do a synchronous SYNCHRONIZE CACHE for our WAL fdatasync(), but FreeBSD UFS wouldn't as far as I know. It does know how to do that (there's a BIO_FLUSH operation, also used by ZFS), but as far as I can see UFS uses it just for its own file system meta-data crash safety currently (see softdep_synchronize()). (There is also no FUA flag for O_[D]SYNC writes, an even more modern invention.)