Re: Writing large build logs to NFS extremely slow?

From: Rick Macklem <rmacklem_at_uoguelph.ca>
Date: Sat, 09 Oct 2021 15:35:23 UTC
Felix Palmen wrote:
>I use a -CURRENT bhyve vm for testing port builds with poudriere. As
>this vm is only running when needed, but I want to always have access to
>the build logs, I use NFS to mount /usr/local/poudriere/data/logs from
>the host.
>
>I noticed some few ports take ridiculously long to build while barely
>using any CPU time at all. On a closer look, that's all ports producing
>a lot of compiler (warning) output, e.g. gcc, gnutls, gtk2, …
>
>So I assume appending to a large file via NFS gets slower and slower. Is
>there any mount option I could try to fix this? Right now I only have
>`nolockd`, I also tried `noncontigwr` which didn't change anything.

Assuming your NFS performance is acceptable for other things and it
is only this log file that is a problem, then I doubt there is much you
can do to improve it.
--> Append (as in O_APPEND opens) are a poor case for NFS, since there
      is no append write in NFS. To approximate append write, it must flush
      all dirty data to the server, do a Getattr to find out the file's current
      size and then do the write (over and over and over again).
You can capture packets with tcpdump and then look at them in wireshark,
to see what I mean.

You could try the "nocto" mount option, which might help, if the log file
is being re-opened many times, but I doubt it will help.

rick

Thinking about alternatives to NFS, are there any news for client-side
9p virtfs? I found <https://github.com/swills/virtfs-9p-kmod> which
still builds with a few minor adaptions, but trying to mount a 9p share
freezes the machine.