howtouselinux

How to test NFS performance with dd on Linux?

Table of Contents

NFS performance is important for the production environment. In this tutorial, we will review how to use DD command to test local storage and NFS storage performance.

Test nfs storage performance on Linux

There are some differences between each testing command. We choose dd command in the following example.

  • dd – without conv=fsync or oflag=direct. This uses filesystem cache.
  • scp – This is bottlenecked by a single CPU core performing encryption, and eventually by OpenSSH’s built-in 64KiB buffer size.
  • rsync – This uses filesystem cache, and cannot bypass the cache.

Note: These tests examples will drop filesystem cache. Please use them carefully.

Test write performance of the local storage with dd command

Drop cache before every test.
echo 3 > /proc/sys/vm/drop_caches
dd if=/dev/zero of=/tmp/testfile.bin bs=1M count=10000 conv=fsync

Test read performance of the local storage with dd command

Drop cache before every test.
echo 3 > /proc/sys/vm/drop_caches
dd if=/tmp/testfile.bin of=/dev/null bs=1M

Test streaming write performance of the NFS client with dd command

Drop cache before every test
echo 3 > /proc/sys/vm/drop_caches
dd if=/dev/zero of=/mnt/nfs/testfile.bin bs=1M count=10000 conv=fsync

Test streaming read performance of NFS client with dd command

Drop cache before every test
echo 3 > /proc/sys/vm/drop_caches
dd if=/mnt/nfs/testfile.bin of=/dev/null bs=1M

Related Post:

David Cao
David Cao

Hey there! I am David, a Cloud & DevOps Enthusiast and 18 years of experience as a Linux engineer. I work with AWS, Git & GitHub, Linux, Python, Ansible, and Bash. I am a technical blogger and a Software Engineer, enjoy sharing my learning and contributing to open-source.