This page looks best with JavaScript enabled

Why NFS Over RDMA Has Much Better FIO Large-Block Read Performance Than NFS

 ·  β˜• 3 min read

1. Background

While testing the performance of NFS Over RDMA, I found that reading a 4M file could actually reach 45GB/s.

1
2
3
fio -numjobs=128 -fallocate=none -iodepth=2 -ioengine=libaio -direct=1 -rw=read -bs=4M --group_reporting -size=100m -time_based -runtime=30 -name=fio-test -directory=/data1/nfs

   READ: bw=42.3GiB/s (45.4GB/s), 42.3GiB/s-42.3GiB/s (45.4GB/s-45.4GB/s), io=1269GiB (1363GB), run=30019-30019msec

Yet the disk’s 4M multi-threaded read performance is only 6 GB/s.

1
2
3
fio -numjobs=128 -fallocate=none -iodepth=2 -ioengine=libaio -direct=1 -rw=read -bs=4M --group_reporting -size=100m -time_based -runtime=30 -name=fio-test -directory=/data1/host

   READ: bw=6190MiB/s (6491MB/s), 6190MiB/s-6190MiB/s (6491MB/s-6491MB/s), io=182GiB (196GB), run=30152-30152msec

2. NFS Over RDMA VS NFS

3. Comparing the Data Copy Paths

3.1 NFS

Transfer path:

Disk -> kernel page cache -> user-space memory (read) -> kernel network buffer (send) -> protocol stack processing -> NIC -> network -> NIC -> protocol stack processing -> kernel network buffer (receive) -> user-space memory (write) -> Disk

3.2 NFS Over RDMA

Transfer path:

Disk -> kernel page cache -> RDMA NIC -> network -> RDMA NIC -> kernel page cache (bypassing the kernel network protocol stack) -> user-space memory (write) -> Disk

3.3 Comparison

ItemNFS (TCP/IP based)NFS Over RDMA
Data copyRequires multiple copies (user space ↔ kernel space, network buffers, etc.)Uses RDMA to access memory directly, reducing copies
CPU usageHigh; the CPU must handle the protocol stack and data copiesLow; RDMA offloads transmission to hardware, easing the CPU load
LatencyHigher; TCP/IP processing adds overheadLow; bypasses the protocol stack and accesses via DMA directly
ThroughputLimited by TCP/IP and CPU processing powerHigh; RDMA provides higher bandwidth
Network protocolRelies on the TCP/UDP transport protocolUses RDMA to access remote memory directly
Use casesSuited to general network environments and low-cost storage sharingSuited to high-performance computing (HPC) and large-scale distributed storage
Deployment complexityEasy to deploy; works on standard EthernetRequires RDMA support (RoCE or InfiniBand); more complex to deploy
Hardware dependencyOnly needs a standard NICRequires an RDMA-compatible NIC (such as RoCE, InfiniBand)

4. Step-by-Step Analysis of the Transfer Path

The transfer path exercised by the FIO test:

kernel page cache -> RDMA NIC -> network -> RDMA NIC -> kernel page cache (bypassing the kernel network protocol stack) -> FIO user-space memory

From the monitoring, you can see that during the test there is only disk activity from the previous test; after that nothing goes through the disk. The direct=1 parameter of fio only controls whether the client uses the cache; it cannot control the NFS server.

But RDMA is running at full speed, reaching 45 GB/s.

Let me test the memory read and write speed:

1
2
3
fio -numjobs=128 -iodepth=2 -ioengine=sync -rw=read -bs=4M --group_reporting -size=100m -time_based -runtime=30 -name=fio-test -directory=/dev/shm

   READ: bw=135GiB/s (145GB/s), 135GiB/s-135GiB/s (145GB/s-145GB/s), io=4057GiB (4356GB), run=30004-30004msec
1
2
3
fio -numjobs=128 -iodepth=2 -ioengine=sync -rw=write -bs=4M --group_reporting -size=100m -time_based -runtime=30 -name=fio-test -directory=/dev/shm

  WRITE: bw=74.4GiB/s (79.9GB/s), 74.4GiB/s-74.4GiB/s (79.9GB/s-79.9GB/s), io=2233GiB (2398GB), run=30008-30008msec

Memory read and write speeds reach 145 GB/s and 79.9 GB/s respectively, far higher than the 45 GB/s of a single RDMA NIC.

Seen this way, the bottleneck when fio tests large-file reads really is the RDMA network transfer speed.


WeChat Official Account
WRITTEN BY
WeChat Official Account