Created
October 16, 2013 07:15
-
-
Save NickWoodhams/7003834 to your computer and use it in GitHub Desktop.
Find the best NFS rsize and wsize for performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPORT="yourdomain.com:/home/shared/folder" | |
MNTDIR="/local/folder" | |
TESTFILE="remote-file.test" | |
NFSPROTO="udp" | |
if [[ -n "$1" ]]; then | |
NFSPROTO="tcp" | |
fi | |
echo "Testing transfer speed of $NFSPROTO on file $EXPORT/$TESTFILE" | |
echo | |
for rsize in 2048 4096 8192 16384 32768 65536 131072 262144 | |
do | |
if mount | grep $MNTDIR > /dev/null; then | |
sudo umount $MNTDIR | |
fi | |
sudo mount -t nfs -o rsize=$rsize,$NFSPROTO,cto,noatime,intr,nfsvers=3 $EXPORT $MNTDIR | |
mntedrsize=$(cat /proc/mounts | grep $MNTDIR | grep -oE "rsize=[0-9]{4,6}" | grep -oE "[0-9]{4,6}") | |
echo $MNTDIR mounted @ rsize \($((mntedrsize/1024))K\), requested rsize \($((rsize/1024))K\) | |
sudo dd if=$MNTDIR/$TESTFILE of=/dev/null | grep "copied" | |
echo | |
done | |
sudo umount $MNTDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment