Skip to content

Commit db3a8b8

Browse files
committed
improve enumeration latencies
1 parent 41ed3e1 commit db3a8b8

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

articles/storage/files/nfs-large-directories.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: khdownie
55
ms.service: azure-file-storage
66
ms.custom: linux-related-content
77
ms.topic: conceptual
8-
ms.date: 05/09/2024
8+
ms.date: 01/22/2025
99
ms.author: kendownie
1010
---
1111

@@ -68,6 +68,57 @@ The following chart compares the time it takes to output results using unaliased
6868

6969
:::image type="content" source="media/nfs-large-directories/sorted-versus-unsorted-ls.png" alt-text="Graph comparing the total time in seconds to complete a sorted ls operation versus unsorted." border="false":::
7070

71+
### Increase the number of hash buckets
72+
73+
The total amount of RAM present on the system doing the enumeration influences the internal working of filesystem protocols like NFS. Even if users aren't experiencing high memory usage, the amount of memory available influences the amount of hash buckets the system has, which impacts/improves enumeration performance for large directories. You can modify the amount of hash buckets the system has to reduce the hash collisions that can occur during large enumeration workloads.
74+
75+
To do this, you'll need to modify your boot configuration settings by providing an additional kernel command that takes effect during boot to increase the number of hash buckets. Follow these steps.
76+
77+
1. Edit the /etc/default/grub file.
78+
79+
```bash
80+
sudo vim /etc/default/grub
81+
```
82+
83+
1. Add the following text to the file. This command will set apart 128MB as the hash table size, increasing system memory consumption by a maximum of 128MB.
84+
85+
```bash
86+
GRUB_CMDLINE_LINUX="ihash_entries=16777216"
87+
```
88+
89+
If `GRUB_CMDLINE_LINUX` already exists, add `ihash_entries=16777216` separated by a space, like this:
90+
91+
```bash
92+
GRUB_CMDLINE_LINUX="<previous commands> ihash_entries=16777216"
93+
```
94+
95+
1. To apply the changes, run:
96+
97+
```bash
98+
sudo update-grub2
99+
```
100+
101+
1. Restart the system:
102+
103+
```bash
104+
sudo reboot
105+
```
106+
107+
1. To verify that the changes have taken effect, once the system reboots, check the kernel cmdline commands:
108+
109+
```bash
110+
cat /proc/cmdline
111+
```
112+
113+
If `ihash_entries` is visible, the system has applied the setting, and enumeration performance should improve exponentially.
114+
115+
You can also check the dmesg output to see if the kernel cmdline was applied:
116+
117+
```bash
118+
dmesg | grep "Inode-cache hash table"
119+
Inode-cache hash table entries: 16777216 (order: 15, 134217728 bytes, linear)
120+
```
121+
71122
## File copy and backup operations
72123

73124
When copying data from an NFS file share or backing up from NFS file shares to another location, for optimal performance we recommend using a share snapshot as the source instead of the live file share with active I/O. Backup applications should run commands on the snapshot directly. For more information, see [NFS file share snapshots](storage-files-how-to-mount-nfs-shares.md#nfs-file-share-snapshots).

0 commit comments

Comments
 (0)