2022-03-24 20:25:45

by Thiago Becker

[permalink] [raw]
Subject: [PATCH RFC v3 0/6] Intruduce nfsrahead

Recent changes in the linux kernel caused NFS readahead to default to
128 from the previous default of 15 * rsize. This causes performance
penalties to some read-heavy workloads, which can be fixed by
tuning the readahead for that given mount.

Specifically, the read troughput on a sec=krb5p mount drops by 50-75%
when comparing the default readahead with a readahead of 15360.

Previous discussions:
https://lore.kernel.org/linux-nfs/[email protected]/
I attempted to add a non-kernel option to mount.nfs, and it was
rejected.

https://lore.kernel.org/linux-nfs/[email protected]/
Attempted to add a mount option to the kernel, rejected as well.

I had started a separate tool to set the readahead of BDIs, but the
scope is specifically for NFS, so I would like to get the community
feeling for having this in nfs-utils.

This patch series introduces nfs-readahead-udev, a utility to
automatically set NFS readahead when NFS is mounted. The utility is
triggered by udev when a new BDI is added, returns to udev the value of
the readahead that should be used.

The tool currently supports setting read ahead per mountpoint, nfs major
version, or by a global default value.

v2:
- explain the motivation

v3:
- adopt already available facilities
- nfsrahead is now configured in nfs.conf

Thiago Becker (6):
Create nfsrahead
nfsrahead: configure udev
nfsrahead: only set readahead for nfs devices.
nfsrahead: add logging
hfsrahead: get the information from the config file.
nfsrahead: User documentation

.gitignore | 2 +
configure.ac | 1 +
systemd/nfs.conf.man | 11 ++
tools/Makefile.am | 2 +-
tools/nfsrahead/99-nfs_bdi.rules.in | 1 +
tools/nfsrahead/Makefile.am | 15 +++
tools/nfsrahead/main.c | 179 ++++++++++++++++++++++++++++
tools/nfsrahead/nfsrahead.man | 72 +++++++++++
8 files changed, 282 insertions(+), 1 deletion(-)
create mode 100644 tools/nfsrahead/99-nfs_bdi.rules.in
create mode 100644 tools/nfsrahead/Makefile.am
create mode 100644 tools/nfsrahead/main.c
create mode 100644 tools/nfsrahead/nfsrahead.man

--
2.35.1


2022-03-25 01:32:33

by Thiago Becker

[permalink] [raw]
Subject: [PATCH RFC v3 1/6] Create nfsrahead

This tool is invoked by udev to find and set the readahead value to NFS
mounts.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1946283
Signed-off-by: Thiago Becker <[email protected]>
---
.gitignore | 1 +
configure.ac | 1 +
tools/Makefile.am | 2 +-
tools/nfsrahead/Makefile.am | 3 +++
tools/nfsrahead/main.c | 7 +++++++
5 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 tools/nfsrahead/Makefile.am
create mode 100644 tools/nfsrahead/main.c

diff --git a/.gitignore b/.gitignore
index c89d1cd2..38ab1d39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,6 +61,7 @@ utils/statd/statd
tools/locktest/testlk
tools/getiversion/getiversion
tools/nfsconf/nfsconf
+tools/nfsrahead/nfsrahead
support/export/mount.h
support/export/mount_clnt.c
support/export/mount_xdr.c
diff --git a/configure.ac b/configure.ac
index e0f5a930..3e1c183b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -737,6 +737,7 @@ AC_CONFIG_FILES([
tools/rpcgen/Makefile
tools/mountstats/Makefile
tools/nfs-iostat/Makefile
+ tools/nfsrahead/Makefile
tools/rpcctl/Makefile
tools/nfsdclnts/Makefile
tools/nfsconf/Makefile
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c3feabbe..40c17c37 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -12,6 +12,6 @@ if CONFIG_NFSDCLD
OPTDIRS += nfsdclddb
endif

-SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat rpcctl nfsdclnts $(OPTDIRS)
+SUBDIRS = locktest rpcdebug nlmtest mountstats nfs-iostat rpcctl nfsdclnts nfsrahead $(OPTDIRS)

MAINTAINERCLEANFILES = Makefile.in
diff --git a/tools/nfsrahead/Makefile.am b/tools/nfsrahead/Makefile.am
new file mode 100644
index 00000000..edff7921
--- /dev/null
+++ b/tools/nfsrahead/Makefile.am
@@ -0,0 +1,3 @@
+libexec_PROGRAMS = nfsrahead
+nfsrahead_SOURCES = main.c
+
diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
new file mode 100644
index 00000000..e454108e
--- /dev/null
+++ b/tools/nfsrahead/main.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(int argc, char **argv, char **envp)
+{
+ unsigned int readahead = 128;
+ printf("%d\n", readahead);
+}
--
2.35.1