|
| 1 | +--- |
| 2 | +title: Improve NFS Azure file share performance with nconnect |
| 3 | +description: Learn how using nconnect with Linux clients can improve the performance of NFS Azure file shares at scale. |
| 4 | +author: khdownie |
| 5 | +ms.service: storage |
| 6 | +ms.topic: conceptual |
| 7 | +ms.date: 03/20/2023 |
| 8 | +ms.author: kendownie |
| 9 | +ms.subservice: files |
| 10 | +--- |
| 11 | + |
| 12 | +# Improve NFS Azure file share performance with `nconnect` |
| 13 | + |
| 14 | +`Nconnect` is a client-side Linux mount option that increases performance at scale by allowing you to use more TCP connections between the client and the Azure Premium Files service for NFSv4.1, while maintaining the resiliency of platform as a service (PaaS). |
| 15 | + |
| 16 | +## Applies to |
| 17 | +| File share type | SMB | NFS | |
| 18 | +|-|:-:|:-:| |
| 19 | +| Standard file shares (GPv2), LRS/ZRS |  |  | |
| 20 | +| Standard file shares (GPv2), GRS/GZRS |  |  | |
| 21 | +| Premium file shares (FileStorage), LRS/ZRS |  |  | |
| 22 | + |
| 23 | +## Benefits of `nconnect` |
| 24 | + |
| 25 | +With `nconnect`, you can increase performance at scale using fewer client machines to reduce total cost of ownership (TCO). `Nconnect` increases performance by using multiple TCP channels on one or more NICs, using single or multiple clients. Without `nconnect`, you'd need roughly 20 client machines in order to achieve the bandwidth scale limits (10 GiB/s) offered by the largest premium Azure file share provisioning size. With `nconnect`, you can achieve those limits using only 6-7 clients. That’s almost a 70% reduction in computing cost, while providing significant improvements to IOPS and throughput at scale (see table). |
| 26 | + |
| 27 | +| **Metric (operation)** | **I/O size** | **Performance improvement** | |
| 28 | +|------------------------|---------------|-----------------------------| |
| 29 | +| IOPS (write) | 64K, 1024K | 3x | |
| 30 | +| IOPS (read) | All I/O sizes | 2-4x | |
| 31 | +| Throughput (write) | 64K, 1024K | 3x | |
| 32 | +| Throughput (read) | All I/O sizes | 2-4x | |
| 33 | + |
| 34 | + |
| 35 | +## Prerequisites |
| 36 | + |
| 37 | +- The latest Linux distributions fully support `nconnect`. For older Linux distributions, ensure that the Linux kernel version is 5.3 or higher. |
| 38 | +- Per-mount configuration is only supported when a single file share is used per storage account over a private endpoint. |
| 39 | + |
| 40 | +## Performance impact of `nconnect` |
| 41 | + |
| 42 | +We achieved the following performance results when using the `nconnect` mount option with NFS Azure file shares on Linux clients at scale. For more information on how we achieved these results, see [performance test configuration](#performance-test-configuration). |
| 43 | + |
| 44 | +:::image type="content" source="media/nfs-nconnect-performance/nconnect-iops-improvement.png" alt-text="Screenshot showing average improvement in IOPS when using nconnect with NFS Azure file shares." border="false"::: |
| 45 | + |
| 46 | +:::image type="content" source="media/nfs-nconnect-performance/nconnect-throughput-improvement.png" alt-text="Screenshot showing average improvement in throughput when using nconnect with NFS Azure file shares." border="false"::: |
| 47 | + |
| 48 | +## Recommendations |
| 49 | + |
| 50 | +Follow these recommendations to get the best results from `nconnect`. |
| 51 | + |
| 52 | +### Set `nconnect=4` |
| 53 | +While Azure Files supports setting `nconnect` up to the maximum setting of 16, we recommend configuring the mount options with the optimal setting of `nconnect=4`. Currently, there are no gains beyond four channels for the Azure Files implementation of `nconnect`. In fact, exceeding four channels to a single Azure file share from a single client might adversely affect performance due to TCP network saturation. |
| 54 | + |
| 55 | +### Size virtual machines carefully |
| 56 | +Depending on your workload requirements, it’s important to correctly size the client machines to avoid being restricted by their [expected network bandwidth](../../virtual-network/virtual-machine-network-throughput.md#expected-network-throughput). You don't need multiple NICs in order to achieve the expected network throughput. While it's common to use [general purpose VMs](../../virtual-machines/sizes-general.md) with Azure Files, various VM types are available depending on your workload needs and region availability. For more information, see [Azure VM Selector](https://azure.microsoft.com/pricing/vm-selector/). |
| 57 | + |
| 58 | +### Keep queue depth less than or equal to 64 |
| 59 | +Queue depth is the number of pending I/O requests that a storage resource can service. We don't recommend exceeding the optimal queue depth of 64. If you do, you won't see any more performance gains. For more information, see [Queue depth](understand-performance.md#queue-depth). |
| 60 | + |
| 61 | +### `Nconnect` per-mount configuration |
| 62 | +If a workload requires mounting multiple shares with one or more storage accounts with different `nconnect` settings from a single client, we can't guarantee that those settings will persist when mounting over the public endpoint. Per-mount configuration is only supported when a single Azure file share is used per storage account over the private endpoint as described in Scenario 1. |
| 63 | + |
| 64 | +#### Scenario 1: (supported) `nconnect` per-mount configuration over private endpoint with multiple storage accounts |
| 65 | + |
| 66 | +- StorageAccount.file.core.windows.net = 10.10.10.10 |
| 67 | +- StorageAccount2.file.core.windows.net = 10.10.10.11 |
| 68 | + - `Mount StorageAccount.file.core.windows.net:/FileShare1 nconnect=4` |
| 69 | + - `Mount StorageAccount2.file.core.windows.net:/FileShare1` |
| 70 | + |
| 71 | +#### Scenario 2: (not supported) `nconnect` per-mount configuration over public endpoint |
| 72 | + |
| 73 | +- StorageAccount.file.core.windows.net = 52.239.238.8 |
| 74 | +- StorageAccount2.file.core.windows.net = 52.239.238.7 |
| 75 | + - `Mount StorageAccount.file.core.windows.net:/FileShare1 nconnect=4` |
| 76 | + - `Mount StorageAccount.file.core.windows.net:/FileShare2` |
| 77 | + - `Mount StorageAccount2.file.core.windows.net:/FileShare1` |
| 78 | + |
| 79 | +> [!NOTE] |
| 80 | +> Even if the storage account resolves to a different IP address, we can't guarantee that address will persist because public endpoints aren't static addresses. |
| 81 | +
|
| 82 | +#### Scenario 3: (not supported) `nconnect` per-mount configuration over private endpoint with multiple shares on single storage account |
| 83 | + |
| 84 | +- StorageAccount.file.core.windows.net = 10.10.10.10 |
| 85 | + - `Mount StorageAccount.file.core.windows.net:/FileShare1 nconnect=4` |
| 86 | + - `Mount StorageAccount.file.core.windows.net:/FileShare2` |
| 87 | + - `Mount StorageAccount.file.core.windows.net:/FileShare3` |
| 88 | + |
| 89 | +## Performance test configuration |
| 90 | + |
| 91 | +We used the following resources and benchmarking tools to achieve and measure the results outlined in this article. |
| 92 | + |
| 93 | +- **Single client:** Azure Virtual Machine ([DSv4-Series](../../virtual-machines/dv4-dsv4-series.md#dsv4-series)) with single NIC |
| 94 | +- **OS:** Linux (Ubuntu 20.40) |
| 95 | +- **NFS storage:** Azure Files premium file share (provisioned 30 TiB, set `nconnect=4`) |
| 96 | + |
| 97 | +| **Size** | **vCPU** | **Memory** | **Temp storage (SSD)** | **Max data disks** | **Max NICs** | **Expected network bandwidth** | |
| 98 | +|-----------------|-----------|------------|------------------------|--------------------|--------------|--------------------------------| |
| 99 | +| Standard_D16_v4 | 16 | 64 GiB | Remote storage only | 32 | 8 | 12,500 Mbps | |
| 100 | + |
| 101 | +### Benchmarking tools and tests |
| 102 | + |
| 103 | +We used Flexible I/O Tester (FIO), a free, open-source disk I/O tool used both for benchmark and stress/hardware verification. To install FIO, follow the Binary Packages section in the [FIO README file](https://github.com/axboe/fio#readme) to install for the platform of your choice. |
| 104 | + |
| 105 | +While these tests focus on random I/O access patterns, you get similar results when using sequential I/O. |
| 106 | + |
| 107 | +#### High IOPS: 100% reads |
| 108 | + |
| 109 | +**4k I/O size - random read - 64 queue depth** |
| 110 | + |
| 111 | +```bash |
| 112 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=4k --iodepth=64 --filesize=4G --rw=randread --group_reporting --ramp_time=300 |
| 113 | +``` |
| 114 | + |
| 115 | +**8k I/O size - random read - 64 queue depth** |
| 116 | + |
| 117 | +```bash |
| 118 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=8k --iodepth=64 --filesize=4G --rw=randread --group_reporting --ramp_time=300 |
| 119 | +``` |
| 120 | + |
| 121 | +#### High throughput: 100% reads |
| 122 | + |
| 123 | +**64k I/O size - random read - 64 queue depth** |
| 124 | + |
| 125 | +```bash |
| 126 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=64k --iodepth=64 --filesize=4G --rw=randread --group_reporting --ramp_time=300 |
| 127 | +``` |
| 128 | + |
| 129 | +**1024k I/O size - 100% random read - 64 queue depth** |
| 130 | + |
| 131 | +```bash |
| 132 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=1024k --iodepth=64 --filesize=4G --rw=randread --group_reporting --ramp_time=300 |
| 133 | +``` |
| 134 | + |
| 135 | +#### High IOPS: 100% writes |
| 136 | + |
| 137 | +**4k I/O size - 100% random write - 64 queue depth** |
| 138 | + |
| 139 | +```bash |
| 140 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=4k --iodepth=64 --filesize=4G --rw=randwrite --group_reporting --ramp_time=300 |
| 141 | +``` |
| 142 | + |
| 143 | +**8k I/O size - 100% random write - 64 queue depth** |
| 144 | + |
| 145 | +```bash |
| 146 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=8k --iodepth=64 --filesize=4G --rw=randwrite --group_reporting --ramp_time=300 |
| 147 | +``` |
| 148 | + |
| 149 | +#### High throughput: 100% writes |
| 150 | + |
| 151 | +**64k I/O size - 100% random write - 64 queue depth** |
| 152 | + |
| 153 | +```bash |
| 154 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=64k --iodepth=64 --filesize=4G --rw=randwrite --group_reporting --ramp_time=300 |
| 155 | +``` |
| 156 | + |
| 157 | +**1024k I/O size - 100% random write - 64 queue depth** |
| 158 | + |
| 159 | +```bash |
| 160 | +fio --ioengine=libaio --direct=1 --nrfiles=4 --numjobs=1 --runtime=1800 --time_based --bs=1024k --iodepth=64 --filesize=4G --rw=randwrite --group_reporting --ramp_time=300 |
| 161 | +``` |
| 162 | + |
| 163 | +## Performance considerations |
| 164 | + |
| 165 | +When using the `nconnect` mount option, you should closely evaluate workloads that have the following characteristics: |
| 166 | + |
| 167 | +- Latency sensitive write workloads that are single threaded and/or use a low queue depth (less than 16) |
| 168 | +- Latency sensitive read workloads that are single threaded and/or use a low queue depth in combination with smaller I/O sizes |
| 169 | + |
| 170 | +Not all workloads require high-scale IOPS or throughout performance. For smaller scale workloads, `nconnect` might not make sense. Use the following table to decide whether `nconnect` will be advantageous for your workload. Scenarios highlighted in green are recommended, while those highlighted in red are not. Those highlighted in yellow are neutral. |
| 171 | + |
| 172 | +:::image type="content" source="media/nfs-nconnect-performance/nconnect-latency-comparison.png" alt-text="Screenshot showing various read and write I O scenarios with corresponding latency to indicate when nconnect is advisable." border="false"::: |
| 173 | + |
| 174 | +## See also |
| 175 | +- For mounting instructions, see [Mount NFS file Share to Linux](storage-files-how-to-mount-nfs-shares.md). |
| 176 | +- For a comprehensive list of mount options, see [Linux NFS man page](https://linux.die.net/man/5/nfs). |
| 177 | +- For information on latency, IOPS, throughput, and other performance concepts, see [Understand Azure Files performance](understand-performance.md). |
0 commit comments