Skip to content

Commit b804c53

Browse files
committed
Readahead value for Linux NFS
1 parent c501642 commit b804c53

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

articles/storage/files/nfs-performance.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn ways to improve the performance of NFS Azure file shares at s
44
author: khdownie
55
ms.service: azure-file-storage
66
ms.topic: conceptual
7-
ms.date: 09/21/2023
7+
ms.date: 09/25/2023
88
ms.author: kendownie
99
---
1010

@@ -18,6 +18,31 @@ This article explains how you can improve performance for NFS Azure file shares.
1818
| Standard file shares (GPv2), GRS/GZRS | ![No, this article doesn't apply to standard SMB Azure file shares GRS/GZRS.](../media/icons/no-icon.png) | ![NFS is only available in premium Azure file shares.](../media/icons/no-icon.png) |
1919
| Premium file shares (FileStorage), LRS/ZRS | ![No, this article doesn't apply to premium SMB Azure file shares.](../media/icons/no-icon.png) | ![Yes, this article applies to premium NFS Azure file shares.](../media/icons/yes-icon.png) |
2020

21+
## Increase read-ahead size to improve read throughput
22+
23+
The `read_ahead_kb` kernel parameter in Linux represents the amount of data that should be "read ahead" or prefetched during a sequential read operation. Linux kernel versions prior to 5.4 set the read-ahead value to the equivalent of 15 times the mounted file system's `rsize` (the client-side mount option for read buffer size). This sets the read-ahead value high enough to improve client sequential read throughput in most cases.
24+
25+
However, beginning with Linux kernel version 5.4, the Linux NFS client uses a default `read_ahead_kb` value of 128 KiB. This small value might reduce the amount of read throughput for large files. Customers upgrading from Linux releases with the larger read-ahead value to those with the 128 KiB default might experience a decrease in sequential read performance.
26+
27+
For Linux kernels 5.4 or later, we recommend persistently setting the `read_ahead_kb` to 15 MiB for improved performance.
28+
29+
To change this value, set the read-ahead size by adding a rule in udev, a Linux kernel device manager. Follow these steps:
30+
31+
1. In a text editor, create the */etc/udev/rules.d/99-nfs.rules* file by entering and saving the following text:
32+
33+
```output
34+
SUBSYSTEM=="bdi" \
35+
, ACTION=="add" \
36+
, PROGRAM="<absolute_path>/awk -v bdi=$kernel 'BEGIN{ret=1} {if ($4 == bdi) {ret=0}} END{exit ret}' /proc/fs/nfsfs/volumes" \
37+
, ATTR{read_ahead_kb}="15360"
38+
```
39+
40+
1. In a console, apply the udev rule by running the [udevadm](https://www.man7.org/linux/man-pages/man8/udevadm.8.html) command as a superuser:
41+
42+
```bash
43+
sudo udevadm control --reload
44+
```
45+
2146
## `Nconnect`
2247

2348
`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).

0 commit comments

Comments
 (0)