Discussion:
NFS tuning on FreeBSD
Devin Heckman
2007-05-29 20:54:19 UTC
Permalink
Hi,

I've recently been attempting to tune NFS on machines in our office,
which mount /home from a single server. I've hit a sort of impasse, and
I don't know why my changes are making any difference to read/write
speeds.

The situation: Our office has multiple Linux workstations. They can
write 256MB to a home directory (NFS mounted) in ~45 seconds when NFSv3 is
enabled, and write the same data in about ~1:30 when I force them to use
NFSv2. (I have taken the necessary steps to ensure that disk caching
does not befuddle these results, and not changed any other options on the
server or client side. Also, the NFS server is running Linux.)

When I force NFSv2 on our FreeBSD machines, it writes the data in about
~1:30. When I specify NFSv3, it writes 256MB in about ~1:40! Please note
that the settings on the server did not change, and I mimicked the Linux
clients' settings in FreeBSD.

Does anyone have any experience tuning NFS mounts on FreeBSD machines?
--
Devin Heckman
System Administrator
RSSP-IT-NI, UC Berkeley
Christopher Hilton
2007-05-29 23:21:53 UTC
Permalink
Devin Heckman wrote:
[snip]
Post by Devin Heckman
Does anyone have any experience tuning NFS mounts on FreeBSD machines?
Not sure if you have tried this but the first thing that I try when
dealing with NFS is using tcp mounts rather than udp. Most of the black
magic of NFS tuning seems to center around compensating for lost udp
fragments on the network. I discovered TCP mounts when I was attempting
to update a box laptop to the latest FreeBSD -STABLE. The laptop had no
built in ethernet so I was stuck using an NE2000 clone. I didn't realize
that under heavy use it would lose packets. This would lead the build
process to stall in the middle. Changing from UDP to TCP makes it the
kernel's responsibility to track down lost fragments and the kernel does
a much better job of it.

-- Chris
--
__o "All I was doing was trying to get home from work."
_`\<,_ -Rosa Parks
___(*)/_(*)___________________________________________________________
Christopher Sean Hilton <chris | at | vindaloo.com>
pgp key: D0957A2D/f5 30 0a e1 55 76 9b 1f 47 0b 07 e9 75 0e 14
Devin Heckman
2007-05-30 02:39:04 UTC
Permalink
Post by Christopher Hilton
Not sure if you have tried this but the first thing that I try when
dealing with NFS is using tcp mounts rather than udp. Most of the black
magic of NFS tuning seems to center around compensating for lost udp
fragments on the network. I discovered TCP mounts when I was attempting
Hi Chris,

Thanks for your input here, I will test with TCP rather than UDP. I
think I already investigated this route, but it may be worth another
shot.

Is there any way that you know of to detail information about the NFS
mount on a client box? For example, using `mount' in Linux will show all
the options with which filesystems (NFS and otherwise) are mounted, but
`mount' in FreeBSD does not display these options.

Specifically, I want to know what version of NFS the connection is
running over, whether or not it's using TCP or UDP, and other
information of that nature. I haven't quite found a utility or file that
contains this information yet.

Thanks,
--
Devin Heckman
System Administrator
RSSP-IT-NI, UC Berkeley
Christopher Hilton
2007-05-30 17:19:58 UTC
Permalink
Devin Heckman wrote:

[snip]
Post by Devin Heckman
Specifically, I want to know what version of NFS the connection is
running over, whether or not it's using TCP or UDP, and other
information of that nature. I haven't quite found a utility or file that
contains this information yet.
That's a good question. Honestly I've never had to look. If I recall
your original question properly your server was FreeBSD and your client
was Linux. In this case the Linux mount command gives you good
information. From FreeBSD the only way that I have found was to embed
the options into the fstab file and use the short version of the mount
command when attaching the filesystem.

For a tcp mount my fstab entry on FreeBSD looks like this:

server:/directory /mountpoint nfs rw,tcp,intr,noauto 0 0

On my Ubuntu Linux box I have to do this:

server/directory /mountpoint nfs rw,tcp,nfsvers=3,intr,noauto 0 0

To get the same effect.

For the FreeBSD NFS client the default is to try NFSv3 first followed by
NFSv2. The documentation on my Ubuntu box indicates that it's Linux
client defaults to NFSv2 and uses UDP. The behavior that I would expect
to see from an Ubuntu Linux NFS client with a FreeBSD NFS server would
be a NFSv2 UDP mount.

Sorry I couldn't give you a better answer. Perhaps someone on the list
knows a better way.

-- Chris
--
__o "All I was doing was trying to get home from work."
_`\<,_ -Rosa Parks
___(*)/_(*)___________________________________________________________
Christopher Sean Hilton <chris | at | vindaloo.com>
pgp key: D0957A2D/f5 30 0a e1 55 76 9b 1f 47 0b 07 e9 75 0e 14
Michael K. Smith - Adhost
2007-06-01 20:13:50 UTC
Permalink
Post by Christopher Hilton
[snip]
Post by Devin Heckman
Does anyone have any experience tuning NFS mounts on FreeBSD
machines?
[snip]

Here's what we use for mount options in /etc/fstab, basically culled
from the O'Reilly NFS book.

rw,tcp,intr,noatime,nfsv3,-w=65536,-r=65536

You have to be careful with noatime if you have applications that use
atime, but we didn't so that cuts down on the number of reads
significantly.

Regards,

Mike

Loading...