Re: Increase FreeBSD NFSv4 nfsd buffer size? Re: Increase default NFSv4 server size "max_block_size" to 4MB
Rick Macklem <[email protected]> Thu, 14 May 2026 17:25:58 -0700
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <CAM5tNy6ogUZqWwq9u+bA-v7zonrneryh+bPMjSKGb8U_qvFakw@mail.gmail.com> |
On Thu, May 14, 2026 at 4:36 PM Rick Macklem <[email protected]> wrote: > > On Thu, May 14, 2026 at 4:26 PM vermaden <[email protected]> wrote: > > > > > ps: I'll ask over on [email protected] to see if they > > > think setting to a larger value to make nfs_server_maxio > > > work is ok with them. > > > > > > rick > > > > I mean ... the script can check if the 'kern.ipc.maxsockbuf' is already 4x'nfs_server_maxio' value or larger. > > > > If 'kern.ipc.maxsockbuf' is larger then needed - do not touch it. > > > > If 'kern.ipc.maxsockbuf' is too small for required 'nfs_server_maxio' value - then set it as 4x'nfs_server_maxio' value. > > > > I doubt this way it will hurt anyone. > We'll see what the transport folk say. They set the default lower for > some reason, I'd assume. It's how much can sit in a socket's recv > queue and I'd guess that might affect things like the recv window > size for TCP, etc. Here is the calculation in the kernel. Of course, this can be re-written in a shell script, but some of the fields (MSIZE, MCLBYTES, etc) are constants in .h files. (If they are transcribed into the shell script, it breaks if any one of them changes and the shell script doesn't get updated.) /* * Check that kern.ipc.maxsockbuf is large enough for * newsrviomax, given the setting of vfs.nfs.bufpackets. */ if ((newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets > sb_max_adj) { /* * Suggest vfs.nfs.bufpackets * maximum RPC message for * sb_max_adj. */ tval = (newsrvmaxio + NFS_MAXXDR) * nfs_bufpackets; /* * Convert suggested sb_max_adj value to a suggested * sb_max value, which is what is set via kern.ipc.maxsockbuf. * Perform the inverse calculation of (from uipc_sockbuf.c): * sb_max_adj = (u_quad_t)sb_max * MCLBYTES / * (MSIZE + MCLBYTES); * XXX If the calculation of sb_max_adj from sb_max changes, * this calculation must be changed as well. */ tval *= (MSIZE + MCLBYTES); /* Brackets for readability. */ tval += MCLBYTES - 1; /* Round up divide. */ tval /= MCLBYTES; printf("nfsd: set kern.ipc.maxsockbuf to a minimum of " "%ju to support %ubyte NFS I/O\n", (uintmax_t)tval, newsrvmaxio); return (EINVAL); } As you can see, doing this inside /etc/rc.d/nfsd is a bit of work and runs into the same problem as the XXX comment notes. rick > > rick > > > > > > Regards, > > vermaden